Setting Up the Server

We now have all the parts we need for our project. Let’s set up the server. But first, a disclaimer: this section isn’t intended as a complete guide to using Express. It provides just enough explanation to get our project working.

Create a project named server, install the Express server, and add the dependencies to the bsconfig.json file:

 cd server
 npm install --save express ​# the server
 npm install --save bs-express ​# ReasonML bindings
 npm install --save @glennsl/bs-json
 npm install --save papaparse ​# to parse the CSV file
 "bs-dependencies"​: [
 "bs-express"​,
 "@glennsl/bs-json"
 ],

The server code starts by instantiating a server and then telling it to listen on port 3000:

Get Web Development with ReasonML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.