fastify-with-reason

0.1.4 • Public • Published

Logo

Fastify bindings for BuckleScript in ReasonML

Getting Started

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

Example Server

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);
  }
);

This server simply respond with a json "Hello, world!" on localhost:3000

yarn build
node src/Server.bs.js

A little Benchmark with Autocannon

On my iMac (2,3 GHz Intel Core i5 - 8 GB 2133 MHz DDR4)

Benchmark

Go to Wiki for documentation (coming soon)

Package Sidebar

Install

npm i fastify-with-reason

Weekly Downloads

2

Version

0.1.4

License

MIT

Unpacked Size

212 kB

Total Files

17

Last publish

Collaborators

  • acciaiodigitale