Next Connect Versions Save

The TypeScript-ready, minimal router and middleware layer for Next.js, Micro, Vercel, or Node.js http/http2

v1.0.0

1 year ago

Published v1

v1.0.0-next.3

1 year ago

What's Changed

Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.2...v1.0.0-next.3

v1.0.0-next.2

1 year ago

v1.0.0-next.1

1 year ago

What's Changed

Full Changelog: https://github.com/hoangvvo/next-connect/compare/v1.0.0-next.0...v1.0.0-next.1

v1.0.0-next.0

1 year ago

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
  • 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

v0.12.1

2 years ago
  • breaking: flow change: handle() does not use onError (ad857bedb0996312ad3a5ea966ce3a60417429a6)
  • fix: make sure handler is resolvable (#178)

v0.11.0

2 years ago
  • Allow regular expressions to be used for route. (#157)

v0.10.2

2 years ago
  • Export the options interface (#152)

v0.10.1

3 years ago
  • Make NextConnect compatible with NextApiHandler (#128)
  • docs(README): fix typo (#123)
  • Mark sideEffects false and update README (21c9c73fe3746e66033fd51e2aa01d479e267ad6)