nxr
v1.0.4
Published
<h1 align="center">Welcome to Next Api Router ๐</h1> <p> <img alt="Version" src="https://img.shields.io/badge/version-1.0.1-blue.svg?cacheSeconds=2592000" /> <a href="#" target="_blank"> <img alt="License: ISC" src="https://img.shields.io/badge/L
Readme
A tiny api router for your next.js project. It turns your api routes to express route like syntax
๐ Homepage
Install
npm install nxrUsage
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.
