Clone this repo to help you start the atdgen workshop.
Install BuckleScript
npm init
# Install bs-platform
npm add bs-platform --dev
# Add runtime to be used by generated code
npm add @ahrefs/bs-atdgen-codec-runtime
# Create basic ReasonReact project
yarn bsb -init . -theme react-lite
We have compiled atdgen for you into a JavaScript file, you can view its documentation by running node bin/atdgen.js --help
.
- Start the server by running
yarn src/Server.bs.js
- Write a function to fetch the
localhost:8000/refdomains
endpoint - Add
Refdomains.re
file and define type like this:tbd
- Use
bs-json
to decode JSON into yourRefdomains.t
type - Create
Index.re
to be your client app entry point - Write logic to display referring domains
- Write refdomains.atd file
- Use generated
Refdomains_bs
module to decode the response
- Use generated
Refdomains_bs
module to decode the API response and encode it to return to client