Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 1.24 KB

README.md

File metadata and controls

72 lines (49 loc) · 1.24 KB

Aeropress

Aeropress is a node server framework for ReasonML. It intends to be a typesafe version of the popular express.js framework.

Installation

$ npm install @aeropress/server

Then add "aeropress" to your bsconfig.json dependencies:

{
  ...
  "bs-dependencies": [
    "aeropress"
  ]
}

Basic Usage

Aeropress is still in early stages. Lots of features coming soon! With that said, the following should work:

open Aeropress;

let getPath = BsNode.NodePath.join2(BsNode.NodeGlobal.__dirname);

let appRouter

  = route
&&& get("/assets/style.css")
&&& Css.file("../client/css/index.css" |> getPath)

||| route
&&& prefix("/assets")
&&& Static.dir("../client/build" |> getPath)

||| route
&&& get("/") &&& Static.file("../client/index.html" |> getPath);


let port = AeroConfig.env("PORT", "7272") |> int_of_string;
let hostname = AeroConfig.env("HOST", "0.0.0.0");

HttpServer.create(appRouter)
|. HttpServer.listen(port, hostname, () => {
  Js.log2("Listening on port", port)
});

TODO

  • Implement response streaming
    • Update AeroCss to use streaming

Build

npm run build

Build + Watch

npm run start

Editor

If you use vscode, Press Windows + Shift + B it will build automatically