Releases: hoangvvo/next-connect
Releases · hoangvvo/next-connect
v1.0.0-next.4
What's Changed
Full Changelog: v1.0.0-next.3...v1.0.0-next.4
v1.0.0
v1.0.0-next.3
What's Changed
Full Changelog: v1.0.0-next.2...v1.0.0-next.3
v1.0.0-next.2
What's Changed
Full Changelog: v1.0.0-next.1...v1.0.0-next.2
v1.0.0-next.1
v1.0.0-next.0
This is the rewrite of next-connect. Most APIs may not be backward-compatible.
- breaking: Drop built-in support for Express.js middleware. You can always create a tiny wrapper function to maintain this functionality. https://github.com/hoangvvo/next-connect#expressjs-compatibility
- Remove
next(err)
pattern
- Remove
- improvement More straight-forward implementation and avoid patchy solutions. Now the handler will resolve based on pure promise resolution. One should expect a boost in perf as well.
- feature Async middleware paradigm like Koa
router
.use(async (req, res, next) => {
const start = Date.now();
await next(); // call next in chain
const end = Date.now();
console.log(`Request took ${end - start}ms`);
})
.use(authy)
.use(databasey)
.get(getty)
.post(posty)
- feature Forward returned values from handlers
router
.use(async (req, res, next) => {
return (await next()) + 1;
})
.use(async () => {
return (await next()) + 2;
})
.use(async () => {
return 3;
});
console.log(await router.run(req, res));
// The above will print "6"
- breaking Move to named export to avoid some issues with bundler. We also have full support for ESM/CJS
- improvement Rewritten in TypeScript
- fix in handler(), if there is no matching .method() (even if there are matchign .use()`, nothing should be executed.
- fix onError should also be triggered when throwing in onNoMatch