https://github.com/andrejewski/better-router
a more better Express Router
https://github.com/andrejewski/better-router
Last synced: 9 months ago
JSON representation
a more better Express Router
- Host: GitHub
- URL: https://github.com/andrejewski/better-router
- Owner: andrejewski
- License: isc
- Created: 2014-08-24T20:09:48.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-08-24T20:24:07.000Z (over 11 years ago)
- Last Synced: 2025-04-05T00:02:37.372Z (10 months ago)
- Language: JavaScript
- Size: 137 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
better-router
=============
The Express Router is almost prefect for modularity. Now it is better.
## Usage
```javascript
var router = require('better-router')([options]);
```
## Differences
- Routers have their own render method. The router has its own `views` and `viewEngine` options so the views directory does not have to exist in any monolithic folder for views. Call `res.routerRender()` instead of `res.render()` for different options, the fucntion signature is the same.
- The mountpath that is purposefully stripped by Express is restored on the router with `router.path()` and set on `res.locals.routerUrl`.
- `res.locals.routerLink` is a templating helper for making hyperlinks and redirects realtive to and within a router.