Update to update: Still getting useful input, so keeping topic open for a few more days
Update: I’m going to keep this topic open for 3 more days to make an even week. After that I’ll make a summary of the opinions contained within this thread and subsequently attempt to work the feedback into the proof of concept I’ve started at https://github.com/ncthbrt/reconstruct. This work is likely to be a long march to reach a point where it could be considered acceptable for broader usage, but bs-express will not be going anywhere and will be maintained in the interim.
I have held the view that express while widely popular is a many senses a poor design. Largely for two reasons:
- Its mutable api makes it easy in larger applications to accidentally open up security holes or introduce unpredictable request flows (have experienced this in practise).
- Express also makes it possible to leave requests hanging.
Bs-express corrects deficiency number 2, but doesn’t help to correct 1. Right now this project is being actively maintained but is more or less in a holding pattern (for example it isn’t really getting new features nor a nice set of documentation). This is largely because I’m not very motivated to improve a design which I consider to be based upon an unsound foundation.
I would like to propose that this project (or a successor to this project) be broken into two parts:
The first is a layer which allows users to describe their web application in a more declarative/functional manner. This layer would probably take its cue from frameworks like Freya, Suave, and Giraffe which are all written in F#. This layer would be platform independent.
The second layer would be where all the platform specific/moving parts live. This layer would take the abstract description of the web server, “compile” and then “execute” it. This could use Node.js or if using native, be run using something like LWT.
This approach means that native and node ecosystems can cross pollinate and provide a stronger, more idiomatic approach to writing web servers.
Keen to hear thoughts…