ReWeb is a web framework based on several foundations:
ReWeb's main concepts are:
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.
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.
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.
You need Esy, you can install the beta using npm:
$ npm install --global esy@latest
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
ReWeb is experimental and not for production use! I am still ironing out the API. But (imho) it looks promising for real-world usage.