Hi, does anyone have a Nact + Express example? I’m imagining that we’d wrap an Express server inside an actor, but I’m a bit fuzzy on how it would look. Maybe something like:
let express = Express.({
let app = express();
App.post(app, ...) /* Set up POST route */
App.listen(app, ());
app
});
let make(parent, messageHandlerActor) = Nact.spawn(
~name="Server",
parent,
(server, _, _) => {
/* ... dispatch message to messageHandlerActor */
Js.Promise.resolve(server)
},
express());
So I’m thinking that the server actor should capture the state of the Express server and be able to restart it if it crashes, and the above would achieve that. But I’m not sure, looking for some guidance.
Thanks