ReasonML is an exciting new language. Since it can compile directly to JS via BuckleScript, we can power our backend server with ReasonML and also build the frontend with ReasonReact (covered in the with-reasonml example).
This example shows how powerful and helpful it is to build a Next.js custom server with a typesafe language. It is based off the custom-server example that uses pure Node.js to build the custom server.
Execute create-next-app
with npm or Yarn to bootstrap the example:
npm init next-app --example custom-server-reasonml custom-server-reasonml-app
# or
yarn create next-app --example custom-server-reasonml custom-server-reasonml-app
Download the example:
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/custom-server-reasonml
cd custom-server-reasonml
Install it and run:
npm install
npm run dev
# or
yarn
yarn dev
npm run next:build
# or
yarn next:build
Run this command after building:
npm start
# or
yarn start