All Projects → yawaramin → Re Web

yawaramin / Re Web

Licence: mit
Experimental web framework for ReasonML & OCaml

Programming Languages

ocaml
1615 projects

Projects that are alternatives of or similar to Re Web

Bastet
A ReasonML/Ocaml library for category theory and abstract algebra
Stars: ✭ 200 (-15.61%)
Mutual labels:  reasonml
Rescript Relay
Use Relay with ReasonML.
Stars: ✭ 214 (-9.7%)
Mutual labels:  reasonml
Scalatra
Tiny Scala high-performance, async web framework, inspired by Sinatra
Stars: ✭ 2,529 (+967.09%)
Mutual labels:  web-framework
Luv
Cross-platform asynchronous I/O and system calls
Stars: ✭ 203 (-14.35%)
Mutual labels:  reasonml
Rebolt Navigation
Fast and declarative router for Rebolt
Stars: ✭ 212 (-10.55%)
Mutual labels:  reasonml
Toa
A pithy and powerful web framework.
Stars: ✭ 220 (-7.17%)
Mutual labels:  web-framework
Koa Web Kit
🚀A Modern, Production-Ready, and Full-Stack Node Web Framework with React
Stars: ✭ 199 (-16.03%)
Mutual labels:  web-framework
Klipse
Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
Stars: ✭ 2,841 (+1098.73%)
Mutual labels:  reasonml
Falco
A functional-first toolkit for building brilliant ASP.NET Core applications using F#.
Stars: ✭ 214 (-9.7%)
Mutual labels:  web-framework
Wonder.js
🚀Functional, High performance 3D Webgl Engine
Stars: ✭ 225 (-5.06%)
Mutual labels:  reasonml
Valum
Web micro-framework written in Vala
Stars: ✭ 203 (-14.35%)
Mutual labels:  web-framework
Bs Express
Express bindings in Reason
Stars: ✭ 207 (-12.66%)
Mutual labels:  reasonml
Jeff
🍍Jeff provides the simplest way to manage web sessions in Go.
Stars: ✭ 223 (-5.91%)
Mutual labels:  web-framework
Reason Urql
Reason bindings for Formidable's Universal React Query Library, urql.
Stars: ✭ 203 (-14.35%)
Mutual labels:  reasonml
Sanic
Async Python 3.7+ web server/framework | Build fast. Run fast.
Stars: ✭ 15,660 (+6507.59%)
Mutual labels:  web-framework
Mojo
✨ Mojolicious - Perl real-time web framework
Stars: ✭ 2,298 (+869.62%)
Mutual labels:  web-framework
Radiance
A Common Lisp web application environment
Stars: ✭ 216 (-8.86%)
Mutual labels:  web-framework
Cphalcon7
Dao7 - Web framework for PHP7.x,项目接洽 QQ 176013762
Stars: ✭ 237 (+0%)
Mutual labels:  web-framework
Relude
FP-inspired prelude/standard library for ReasonML projects
Stars: ✭ 230 (-2.95%)
Mutual labels:  reasonml
Lwt Node
Reason Implementation of Node.js API ✨🏎🚀✨
Stars: ✭ 226 (-4.64%)
Mutual labels:  reasonml

ReWeb - a type-safe ergonomic ReasonML and OCaml web framework (WIP)

npm Build Status Test Status

ReWeb is a web framework based on several foundations:

  • The amazing work of the people behind Httpaf, H2, Esy, and others
  • The core idea of 'Your server as a function' by Marius Eriksen which was also the idea behind Twitter's Finagle web stack
  • Jasim Basheer's essay 'Rails on OCaml' which identifies the need for an ergonomic, Rails-like web framework that still preserves the type safety benefits of OCaml.

ReWeb's main concepts are:

  • Services: a service is a function from a request to a promise of response (i.e. an asynchronous function).
  • Filters: a filter is a function that takes a service as input and returns a service as output. It can be inserted into the 'request pipeline' and manipulate the request before the service finally handles it.
  • Server: a server is a function that takes a route (pair of HTTP method and path list) as input and returns a service as output.
  • Type-safe request pipeline: requests have a type parameter that reveals their 'context' i.e. some data that's stored inside them. Filters and services must change requests correctly and in the right order, or the compiler will present type errors.

Notice that all the main concepts here are just functions. They are all composeable using just function composition. Services can call other services. Filters can slot together by calling each other. Servers can delegate smaller scopes to other servers. See bin/Main.re for examples of all of these.

Documentation

Examples

Fullstack Reason

Check out the demo repo which shows a fullstack Reason setup with ReWeb and ReasonReact, with code sharing: https://github.com/yawaramin/fullstack-reason/

This repo can be cloned and used right away for a new project.

Examples directory

Check out the examples/ directory for small, self-contained basic examples.

Bin directory

Finally, check out the example server in the bin/ directory. The Main.re file there has extensive examples of almost everything ReWeb currently supports.

Run the example server:

$ esy bin

Send some requests to it:

$ curl localhost:8080/hello
$ curl localhost:8080/auth/hello
$ curl --user 'bob:secret' localhost:8080/auth/hello

Go to http://localhost:8080/login in your browser, etc.

Try

You need Esy, you can install the beta using npm:

$ npm install --global [email protected]

Then run the esy command from this project root to install and build dependencies.

$ esy

Now you can run your editor within the environment (which also includes merlin):

$ esy $EDITOR
$ esy vim

Alternatively you can try vim-reasonml which loads esy project environments automatically.

After you make some changes to source code, you can re-run project's build again with the same simple esy command.

$ esy

Generate documentation:

$ esy doc
$ esy open '#{self.target_dir}/default/_doc/_html/index.html'

Shell into environment:

$ esy shell

Run the test suite with:

$ esy test

Warning

ReWeb is experimental and not for production use! I am still ironing out the API. But (imho) it looks promising for real-world usage.

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].