RFC: The future of Bs-Express


#5

I second the express-like API style.

Alternatively, I think I might even like a HAPI-style of API more? I’ve written JS for both, and the HAPI performance was worse than express, but I felt like it was more expressive. It would be even better if it had something nice like Swagger that came with it.

Maybe Reason can combine better-than-express performance with the niceness of HAPI?


#6

Lot of ocaml web stuff has been done, for example, http://ocsigen.org/. Matter of porting maybe…


#7

That is a good point @idkjs. I haven’t searched though projects in Ocaml that would be suitable for porting.

Ocsigen’s work on web servers is interesting but it is quite a departure from what I’d say people are typically used to in a web server. A project like opium feel a little bit more approachable: https://github.com/rgrinberg/opium. Though that just may be the way ocsigen presents and documents their projects.


#8

I’d go the route of making it feel like express while fixing up some of it’s shortcomings. If it’s any guide, ReasonReact is a bit of a departure from what people are used to with JS React (reducerComponent, etc.). I think devs just need to know that there is energy/activity in a module, and that it’s familiar enough.

As an express user myself starting to look hard at Reason, you’d connect with me if it was just as easy to set up an app and register routes in a similar way. I’d more than tolerate differences if the design improvements were clearly explained. In fact, it would just make a stronger case for why I’d want to build an app wth Reason.


#9

I’m super impressed by rust’s rocket web framework – I’d love to come up with something as usable & fast & safe out of the box!


#10

@jaredly Rocket looks very cool.
Q: What is the thing about rocket that impressed you the most? The typesafe routing engine?


#11

For what it worth, we are using ocaml as server side language at very big scale at Ahrefs, including http server, and it works pretty well. So I don’t think you will be blocked unless you are Facebook or Google.


#12

@Khady Out of interest. What are you using as your webserver at Ahrefs currently?


#13

We are using https://github.com/ahrefs/devkit/blob/master/httpev.ml
It is probably too low level for what you would like to do. But I think it’s a good example that “simple” stuff can reasonably scale up.


#14

Yeah – I love that it feels as easy to use & get started with as express (maybe easier?) but it’s much safer


#15

One thing that might would help in applying ocaml tested stuff would be to maybe roadmap how one might use @Khady’s suggestion in a reasonml project. What would it take to do that? Doesnt seem to hard. Maybe build it with esy? I need to see that work flow one time. Would be useful in all kinds of other projects as well and would accelerate the proliferation of ocaml work into reasom land.


#16

@idkjs: Would you mind explaining a little more about what using @Khady’s suggestion means? I’m not quite clear as to what you’re suggesting.


#17

@ncthbrt i guess I mean, what would a quick port look like. ahrefs doesnt seem to be using it in public reason project yet though they are writing bindings so they might be.


#18

@idkjs Looking at the code, feels like it would be something that would be quite difficult to port. Which is why I would rather attempt to create an abstraction layer which could be easily ported to different backends.


#19

i love it when you talk that way. I dont know what an abstraction layer is but I can guess what you mean. So what would an ‘abstraction layer’ look like then on that project?


#20

I agree with having a familiar interface for newcomers to ReasonML.

I also think that there is probably a lot of room for improvement, so the ideal would be to do both IMO.


#21

Just a bit busy at work, @idkjs, but can draw up a diagram later on.


#22

What is your current throughput in RPS? I’m assuming that you’re using horizontal scaling with some sort of containerization scheme?


#23

ReasonML seems an obvious choice for a tierless web framework like Ocsigen or Ur/Web, since it already has a story for the Javascript tier. What I find nice with Ur/Web is that it is very opinionated, it makes learning easier (I am not saying it is easy!). There might be some ideas worth stealing. The paper I found most readable, is: http://adam.chlipala.net/papers/UrWebPOPL15/


#24

Will give the paper a read. Thanks @th3rac25 :slight_smile: