The TypeScript-ready, minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2
Published v1
Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.3...v1.0.0-next.4
Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.2...v1.0.0-next.3
Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.1...v1.0.0-next.2
Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.0...v1.0.0-next.1
This is the rewrite of next-connect. Most APIs may not be backward-compatible.
next(err)
patternrouter
.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)
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"