https://github.com/appleple/a-dispatcher
Just a simple url-dispatcher you can use with regex
https://github.com/appleple/a-dispatcher
es6 npm
Last synced: 11 months ago
JSON representation
Just a simple url-dispatcher you can use with regex
- Host: GitHub
- URL: https://github.com/appleple/a-dispatcher
- Owner: appleple
- License: mit
- Created: 2017-11-02T05:56:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-02T06:06:03.000Z (over 8 years ago)
- Last Synced: 2025-04-28T05:34:54.624Z (about 1 year ago)
- Topics: es6, npm
- Language: JavaScript
- Size: 32.2 KB
- Stars: 3
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# a-dispatcher
Just a simple url-dispatcher you can use with regex
```sh
npm install a-dispatcher --save
```
```js
import Dispatcher from 'a-dispatcher';
import User from './user-info';
import Edit from './user-info';
const dispatcher = new Dispatcher();
dispatcher.addRoute('^/user', User);
dispatcher.addRoute('^/edit', Edit);
dispatcher.run(location.pathname);
```