Implementing the Client
Now let’s get the client side working. We’ll need to use bs-webapi to access the DOM, bs-fetch to send data to the server and get a response, and bs-json to analyze the response. Create a project named client and install those libraries:
| cd client |
| npm install --save bs-webapi |
| npm install --save bs-fetch |
| npm install --save @glennsl/bs-json |
Remember to add the dependencies to the bsconfig.json file:
| "bs-dependencies": [ |
| "bs-webapi", |
| "bs-fetch", |
| "@glennsl/bs-json" |
| ], |
Our HTML page will be just enough to get the job done: a <select> menu to select the summary we want, and a <div> to hold the resulting table:
| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Shirt Statistics</title> ... |
Get Web Development with ReasonML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.