Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 1.58 KB

File metadata and controls

58 lines (41 loc) · 1.58 KB

Custom server ReasonML example

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.

How to use

Using create-next-app

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 manually

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

Run the development app

Install it and run:

npm install
npm run dev
# or
yarn
yarn dev

Build the app

npm run next:build
# or
yarn next:build

Run the production app

Run this command after building:

npm start
# or
yarn start