next-flexible-routes
v0.2.3
Published
Next Flexible Routes is a library to takle the pain of routing in a next.js app.
Downloads
7
Maintainers
Readme
Next Flexible Routes
Next Flexible Routes is a library to takle the pain of routing in a next.js app.
We have been using alternative libraries internally at CreditSCRIPT for a while and we have fund them very easy to start with but very hard to scale.
The reason is routing maps tend to change over time and it gets progressively hard to refactor without a strictly typed environment.
We decided to takle the pain and build a library for our own usage and we ended up deciding to open-source it thinking the community could benefit from it.
Features
- Strongly typed link generation
- Strongly typed parameters and query extraction
- Minimal API to define routes
- Maximum Flexibility on deployment
- Custom (pluggable) codec to encode parameters (Date/UUID/etc)
- Hash anchor management
Usage
Examples can be found in the with-next-flexible-routes package
Showcase
Documentation
Please refer to api-docs and middleware-docs
Installation
yarn add next-flexible-routes
you will need additional peer dependencies to be installed:
"express": "^4.16.4",
"fp-ts": "^1.15.0",
"fp-ts-contrib": "^0.0.2",
"io-ts": "^1.8.4",
"lodash": "^4.17.11",
"next": "^8.0.3",
"path-to-regexp": "^3.0.0",
"query-string": "^6.4.2",
"react": "^16.8.5",
"react-dom": "^16.8.5"
quickly:
yarn add express fp-ts fp-ts-contrib io-ts lodash next path-to-regexp query-string react react-dom
Contributing
Pull requests are welcome. Please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Thanks
Huge thanks goes to the authors of fp-ts, io-ts, fp-ts-contrib, next.js, and any used library