Finally, after months of hard work, different implementation decisions, collaborations with contributors I’m thrilled to announce the first stable release of tinyhttp!
Express API implementation
100% ready. The only method that isn’t implemented is app.param
, which was deprecated in Express 4.11.
Core
Catching errors in async handlers
errors thrown in async handlers are now catched and passed to next
, e.g. if an error is throwed in a handler it won’t crash and will keep working.
Example:
import { App } from '@tinyhttp/app'
const app = new App()
app.use(async (_req, _res) => {
throw `error`
})
app.listen(3000)
The app will return the error and send 500 status:
$ curl localhost:3000
error
Custom middleware extensions
WIth the new applyExtensions
parameter you can define your own req
/ res
extensions, or disable all tinyhttp’s extensions to achieve the best performance.
import { App } from '@tinyhttp/app'
import { send } from '@tinyhttp/send'
const app = new App({
applyExtensions: (req, res, next) => {
// now tinyhttp only has a `res.send` extension
res.send = send(req, res)
}
})
Other changes
- Test coverage is increased to 92%
- The majority of tinyhttp’s modules have more flexible types now which don’t require the full implementation of
IncomingMessage
andServerResponse
objects but only the properties which are used inside the module. This will let developers use these packages inside their own projects and not only in Node.js runtime. - Docs are updated with the current status of the project.
Ehhhh why did you steal my article about my framework without even mentioning me as an author? That’s a bad thing to do
I’m just commenting to let you be aware of of the exceptional discovery my cousin’s daughter enjoyed going through your blog. She discovered lots of issues, most notably how it is like to have a very effective giving heart to have many more effortlessly fully understand certain extremely tough matters. You really did more than my desires. Many thanks for displaying the helpful, healthy, educational and also easy thoughts on the topic to Gloria.