1.0.4 ā¢ Published 3 years ago
nxr v1.0.4
A tiny api router for your next.js project. It turns your api routes to express route like syntax
š Homepage
Install
npm install nxr
Usage
In your pages/api
folder create a file called [...all].js
or [...all].ts
if using typescript and copy below to the file.
import router from "nxr";
router.get("/", (req, res) => {
res.send({ ok: 1 });
});
export default router.handler;
How it works?
It takes advantage of next.js catch all routes and parse and bind function to the route.
Author
š¤ Shahid Kamal
- Website: https://shahid.codes
- Twitter: @shahidcodes
- Github: @shahidcodes
š¤ Contributing
Contributions, issues and feature requests are welcome!Feel free to check issues page.