https://github.com/g-harel/drl
url addressable function storage
https://github.com/g-harel/drl
Last synced: about 2 months ago
JSON representation
url addressable function storage
- Host: GitHub
- URL: https://github.com/g-harel/drl
- Owner: g-harel
- License: mit
- Created: 2017-06-03T02:54:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-01T03:27:25.000Z (over 7 years ago)
- Last Synced: 2025-02-17T11:37:54.431Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [drl](https://github.com/g-harel/drl)
> Url addressable function storage.
Store callback functions and invoke them using a url path.
Express-style route matching. (ex. `/(apple-)?icon-:res(\\d+).png`)
Priority to first added matching route.
## Install
````
$ npm install --save drl
````## Usage
````javascript
const drl = require('drl');const store = drl();
// adding a path
store.add(path, callback);
┌┘ └┐
String Function// querying paths
store.exec(path, params?);
┌┘ └┐
String Object
````````javascript
const drl = require('drl');const store = drl();
store.add('/user/:id/execute', ({id, action}) => {
// ...
return true;
});store.exec('user/123/execute', {action: 'DELETE'}); // true
````