@everestate/serverless-router
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -5,3 +5,3 @@ The router delegates route matching to its plugins. So, routing subject could be represented with anything: object, string or even number. The plugin is responsible to provide the matching machanism. | ||
1. We need to declare new class which is extended from 'BasePlugin': | ||
1. We need to declare new class which is extended from "`BasePlugin`": | ||
@@ -15,3 +15,3 @@ ```javascript | ||
2. Router expects plugin to provide one or more public intefaces available to plugin users. | ||
2. Router expects plugin to provide one or more public interfaces available to plugin users. | ||
@@ -59,2 +59,17 @@ ```javascript | ||
The plugin would be accessible on router's instance by lower-cased class name as | ||
```javascript | ||
const router = new Router([EvenOdd]); | ||
router.evenodd.even(); | ||
``` | ||
The accessibility alias could be customized with | ||
```javascript | ||
class EvenOdd extends BasePlugin { | ||
static get pluginName() { return 'foobar'; } | ||
} | ||
``` | ||
That's basically it, let's try it out now: | ||
@@ -93,4 +108,3 @@ | ||
Also some real plugin packages: | ||
* [serverless-router-web](https://github.com/everestate/serverless-router-web) | ||
* [serverless-router-aws](https://github.com/everestate/serverless-router-aws) | ||
* [serverless-router-dynamics](https://github.com/everestate/serverless-router-dynamics) |
{ | ||
"name": "@everestate/serverless-router", | ||
"version": "0.3.0", | ||
"description": "Dependency-free, minimalist, pluggable, universal router.", | ||
"version": "0.3.1", | ||
"description": "Serverless, minimalist, pluggable, universal router.", | ||
"keywords": [ | ||
@@ -30,4 +30,7 @@ "serverless", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.10.0", | ||
"eslint": "^5.11.1", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
@@ -34,0 +37,0 @@ "eslint-plugin-import": "^2.14.0", |
# @everestate/serverless-router | ||
> Dependency-free, minimalist, pluggable, universal router. | ||
> Serverless, minimalist, pluggable, universal router. | ||
@@ -15,3 +15,2 @@ ## Installation | ||
* [serverless-router-web](https://github.com/everestate/serverless-router-web) | ||
* [serverless-router-aws](https://github.com/everestate/serverless-router-aws) | ||
@@ -24,3 +23,3 @@ * [serverless-router-dynamics](https://github.com/everestate/serverless-router-dynamics) | ||
const Router = require('@everestate/serverless-router'); | ||
const Web = require('@everestate/serverless-router-web'); | ||
const { Http } = require('@everestate/serverless-router-aws'); | ||
@@ -30,5 +29,5 @@ cosnt userService = require('../services/userService'); | ||
function dispatch(event) { | ||
const router = new Router([Web]); | ||
const router = new Router([Http]); | ||
router.web | ||
router.http | ||
.post('/users', () => | ||
@@ -35,0 +34,0 @@ userService.createUser(event.body)) // returns promise |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181239
79