Livewire is 0.4. It’s been bitten by a radioactive unicorn and has all kinds of new Fantasy Land-begotten superpowers.
Gone is 0.3’s crappy pseudo-Java subclass polymorphism, RouterFactory, HandlerContext bullshit. 0.4 is leaner, meaner, better, faster, stronger. I’ve cut the code size by almost a third, and added a bunch of features.
Gone is the dependency on Fibers. They’re brittle, unportable, and not in the Node spirit. Everything is Promises, so it’s easy to chain async operations in your handlers. You can even wrap Node-style callback functions with fantasy-async.
Result class makes it way easier to construct responses: no need to wrap streams in objects. 0.4 doesn’t need to guess what your handlers are returning, it knows, because you’re always returning a
Promise Result. Don’t worry, we’ve got helpers like
Result.ok, and handlers to turn your
EitherT Promise Error Any async wrappers into nice
Promise Results. Promise-returning body parsers let you slurp up a request body asynchronously. And there’s a new, more efficient url parser.
The shoulders of giants
Livewire 0.4 is inspired by Snap and Play!, and wouldn’t be anywhere without the fantastic (pun intended!) Fantasy Land community. And if it wasn’t for George Zahariev’s Livescript it wouldn’t be anything like the same. Cheers, folks.
I’ll be slowly fleshing out the features over the next few weeks. I’ll also be resurrecting Gusto on top of Livewire, though not quite in the same form. And there’s an app I’ve been wanting to write that set off this whole “oh, hey, monadic Livewire” thing. Stay tuned.