Fastify bindings for BuckleScript in ReasonML
Create a new project:
bsb -init server -theme basic-reason
Install fastify-with-reason using npm:
yarn add fastify-with-reason
Then add fastify-with-reason as a dependency to bsconfig.json
Create a Server.re inside src:
open Fastify;
let app = createServer(~logger=true);
app->get("/", (_request, reply) => reply->send("Hello, world!"));
app->listen(3000, result =>
switch (result) {
| Ok(_address) => ()
| Error(error) =>
app->logError(error);
Node.Process.exit(1);
}
);
2310: syntax error, consider adding a `;' before
This server simply respond with a json "Hello, world!" on localhost:3000
yarn build
node src/Server.bs.js
On my iMac (2,3 GHz Intel Core i5 - 8 GB 2133 MHz DDR4)
Go to Wiki for documentation (coming soon)