/atdgen-workshop-starter

Starter project for ReasonConf atdgen workshop

Primary LanguageJavaScriptMIT LicenseMIT

Atdgen Workshop Starter Project

Clone this repo to help you start the atdgen workshop.

Prerequisites

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.

Suggested approach

Milestone 1

  1. Start the server by running yarn src/Server.bs.js
  2. Write a function to fetch the localhost:8000/refdomains endpoint
  3. Add Refdomains.re file and define type like this:
    tbd
    
  4. Use bs-json to decode JSON into your Refdomains.t type
  5. Create Index.re to be your client app entry point
  6. Write logic to display referring domains

Milestone 2

  1. Write refdomains.atd file
  2. Use generated Refdomains_bs module to decode the response

Milestone 3

  1. Use generated Refdomains_bs module to decode the API response and encode it to return to client