The TypeScript-ready, minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2
MIT License
Bot releases are hidden (Show)
Published v1
Published by hoangvvo over 1 year ago
Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.3...v1.0.0-next.4
Published by hoangvvo about 2 years ago
Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.2...v1.0.0-next.3
Published by hoangvvo over 2 years ago
Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.1...v1.0.0-next.2
Published by hoangvvo over 2 years ago
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"
Published by hoangvvo over 2 years ago
Published by hoangvvo almost 4 years ago
Published by hoangvvo about 4 years ago
Published by hoangvvo over 4 years ago
This is a breaking change for TS users: See TypeScript section for more info.
Published by hoangvvo over 4 years ago
Published by hoangvvo over 4 years ago
Published by hoangvvo over 4 years ago
Published by hoangvvo over 4 years ago
Published by hoangvvo over 4 years ago