All Projects → shawn-mcginty → naboris

shawn-mcginty / naboris

Licence: MIT License
Simple, fast, minimalist http server for OCaml/ReasonML

Programming Languages

reason
219 projects
Vue
7211 projects
C++
36643 projects - #6 most used programming language
SCSS
7915 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects
ocaml
1615 projects

Projects that are alternatives of or similar to naboris

yarx
An awesome reverse engine for xray poc. | 一个自动化根据 xray poc 生成对应 server 的工具
Stars: ✭ 229 (+222.54%)
Mutual labels:  http-server
reason-nodejs
Node bindings for Reason and Bucklescript
Stars: ✭ 105 (+47.89%)
Mutual labels:  reasonml
EthernetWebServer
This is simple yet complete WebServer library for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and…
Stars: ✭ 118 (+66.2%)
Mutual labels:  http-server
react-multiversal
React components that works everywhere (iOS, Android, Web, Node)
Stars: ✭ 43 (-39.44%)
Mutual labels:  reasonml
lazurite
A simple http server.
Stars: ✭ 17 (-76.06%)
Mutual labels:  http-server
awesome-ppx-reasonml
curated list of reasonml PPX rewriter
Stars: ✭ 28 (-60.56%)
Mutual labels:  reasonml
onetricks.net
(WIP) kayn-powered (typescript node.js) ReasonReact app presenting you a dashboard of high ELO one trick ponies in League of Legends
Stars: ✭ 13 (-81.69%)
Mutual labels:  reasonml
crab
🦀 a simple web server
Stars: ✭ 18 (-74.65%)
Mutual labels:  http-server
node-jsonrpc2
JSON-RPC 2.0 server and client library, with HTTP (with Websocket support) and TCP endpoints
Stars: ✭ 103 (+45.07%)
Mutual labels:  http-server
WebRelay
A netcat-like utility for windows for transferring files and streams over HTTP with support for relaying through a remote host (via websocket), a webclient, and a shell extension. PRs welcome!
Stars: ✭ 29 (-59.15%)
Mutual labels:  http-server
cs
开箱即用的基于命令的消息处理框架,让 websocket 和 tcp 开发就像 http 那样简单
Stars: ✭ 19 (-73.24%)
Mutual labels:  http-server
Swiftly
Swiftly is an easy to use Qt/C++ web framework
Stars: ✭ 20 (-71.83%)
Mutual labels:  http-server
finch-demo
Introduction to Finch, a lightweight HTTP server library based on Twitter's Finagle.
Stars: ✭ 19 (-73.24%)
Mutual labels:  http-server
toyhttpd
I/O 模型练手代码,分别使用阻塞式 I/O、select、poll 和 epoll 和 Java NIO 实现了简单的 HTTP Server
Stars: ✭ 43 (-39.44%)
Mutual labels:  http-server
serville
Serville, the fast and easy HTTP API library for NodeJS.
Stars: ✭ 31 (-56.34%)
Mutual labels:  http-server
relude-random
Composable random generators based on the PCG paper
Stars: ✭ 15 (-78.87%)
Mutual labels:  reasonml
oxen-storage-server
Storage server for Oxen Service Nodes
Stars: ✭ 19 (-73.24%)
Mutual labels:  http-server
DeepfakeHTTP
DeepfakeHTTP is a web server that uses HTTP dumps as a source for responses.
Stars: ✭ 373 (+425.35%)
Mutual labels:  http-server
bs-getenv
ReasonML/BuckleScript PPX for embedding env variables
Stars: ✭ 25 (-64.79%)
Mutual labels:  reasonml
Kvpbase
Scalable, simple RESTful object storage platform, written in C#
Stars: ✭ 43 (-39.44%)
Mutual labels:  http-server

naboris

Simple, fast, minimalist web framework for OCaml/ReasonML built on httpaf and lwt.

https://naboris.dev

Build Status opam version 0.1.3

// ReasonML
let serverConfig: Naboris.ServerConfig.t(unit) = Naboris.ServerConfig.create()
  |> Naboris.ServerConfig.setRequestHandler((route, req, res) => switch(Naboris.Route.path(route)) {
    | ["hello"] =>
      res
        |> Naboris.Res.status(200)
        |> Naboris.Res.text(req, "Hello world!");
    | _ =>
      res
        |> Naboris.Res.status(404)
        |> Naboris.Res.text(req, "Resource not found.");
  });

Lwt_main.run(Naboris.listenAndWaitForever(3000, serverConfig));
/* In a browser navigate to http://localhost:3000/hello */
(* OCaml *)
let server_config: unit Naboris.ServerConfig.t = Naboris.ServerConfig.create ()
  |> Naboris.ServerConfig.setRequestHandler(fun route req res ->
    match (Naboris.Route.path route) with
      | ["hello"] ->
        res
          |> Naboris.Res.text req "Hello world!";
      | _ ->
        res
          |> Naboris.Res.status 404
          |> Naboris.Res.text req "Resource not found.";
  ) in


let _ = Lwt_main.run(Naboris.listenAndWaitForever 3000 server_config)
(* In a browser navigate to http://localhost:3000/hello *)

Pre 1.0.0 the API may be changing a bit. A list of these changes will be kept below.

Contents

Installation

Note

Naboris makes heavy use of Lwt. For better performance it is highly recommended (however optional) to also install conf-libev which will configure Lwt to run with the libev scheduler. If you are using esy you will have to install conf-libev using a special package.

conf-libev also requires that the libev be installed. This can usually be done via your package manager.

brew install libev

or

apt install libev-dev

opam

opam install naboris

esy

"@opam/naboris": "^0.1.3"

dune

(libraries naboris)

Scaffolding

For a basic Reason project

git clone [email protected]:shawn-mcginty/naboris-re-scaffold.git
cd naboris-re-scaffold
npm run install
npm run build
npm run start

For a basic OCaml project

git clone [email protected]:shawn-mcginty/naboris-ml-scaffold.git
cd naboris-ml-scaffold
npm run install
npm run build
npm run start

Development

Any help would be greatly appreciated! 👍

To run tests

esy install
npm run test

Breaking Changes

From To Breaking Change
0.1.2 0.1.3 secret argument added to all session configuration APIs.
0.1.0 0.1.1 ServerConfig.setSessionGetter changed to ServerConfig.setSessionConfig which also allows ~maxAge and ~sidKey to be passed in optionally.
0.1.0 0.1.1 All RequestHandler.t and Middleware.t now return Lwt.t(Res.t) instead of Lwt.t(unit)
0.1.0 0.1.1 Res.reportError now taxes exn as the first argument to match more closely the rest of the Res API.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].