ReWeb & Fullstack Reason

reasonreact

#1

Hello, I’ve published a couple of repos that people here might be interested to try out:

You can clone and run the latter directly according to the instructions there (Windows may not work for now unfortunately).

Would love to get feedback :slight_smile:


#2

This looks awesome! The documentation and user manual are really impressive.


#3

Thank you! Appreciate it :slight_smile:


#4

:clap:

Very cool! I’m also trying to build a framework, but purely in BuckleScript to target Node.js. The construction/composition of functions in your framework makes writing user code very elegant!

I do have a question about the routing system. I’m not so familiar with OCaml magic, but I wonder how you would be able to implement listing or introspection of all registered routes in the system for something like a CORS middleware?


#5

Thank you! At the moment I don’t have a good answer for introspecting all the routes, because they are static OCaml patterns, they don’t exist as first-class values. But, I can tell you that there must always be a single entry point for all the routes. So you can definitely add a CORS and other middleware to all routes. For example, if you wrote a filter cors:

// Your 'real server'
let server = fun
  | (`GET, ([] | [""])) => hello
  | _ => notFound;

// Wrapped with a cors filter
let server = (meth, path) => cors @@ server @@ (meth, path);

// Run the wrapper server
let () = Server.serve(server);

In fact I am going to add a config system to ReWeb and put in place some default-configured security filters on all servers out of the box. The config will be overridable.


#6

Looking great, the documentation is looking really good for such a new project as well, keep it up!


#7

Thank you! Having good documentation is super important for me :slight_smile:


#8

This is amazing!