A fast and productive router to improve the UX (User eXperience) of any frontend application. Inspired by the router of Express JS (amongst others), Routux supports:
- middlewares,
- Regex pattern,
- named route,
- route reverse,
- asynchronicity,
- error handler,
- ... and others useful features.
Terminal:
npm install routux --save
JS:
var routux = require('routux');
var router = new routux.Router();
router.use('/', function(req, next) {
// Your logic here
});
router.run();
Download dist/routux.min.js file and add in your HTML file:
<script src="./path-of-your-js-files/routux.min.js"></script>
Then routux
is in the global scope:
var router = new routux.Router();
router.use('/', function(req, next) {
// Your logic here
});
router.run();
<script src="https://rawgit.com/Nicolab/routux/master/dist/routux.min.js"></script>
You can change master
by a specific commit hash.
Example for v0.3.0
:
<script src="https://cdn.rawgit.com/Nicolab/routux/e43f70c2/dist/routux.min.js"></script>
Note: please, use the latest version
See the doc and the examples directory.
Routux is developped in ES6 (EcmaScript6) in src directory and compiled to ES5 in the dist/routux.min.js file.
Build a minified distributable, in the terminal:
gulp dist.build
Develop with the automatic rebuilds (the distributable and the unit tests):
gulp testing
Routux is unit tested with Unit.js, Mocha and Webdriver.io.
TODO: There are still things to test.
MIT (c) 2016, Nicolas Tallefourtane.
Routux is designed and built with love by
Nicolas Talle |