Created
January 16, 2019 09:38
-
-
Save gwuah/2b1627c7edf15a02e04598d3ef7aa2ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Ottis = require('Ottis'); | |
const router = Ottis.router; | |
/* easily declare your route permissions. */ | |
/* can make only post, get, and put requests to /users */ | |
router("/users").post().get().put().done(); | |
/* can make any type of http request to /users */ | |
router("/products").all(); | |
/* can make any type of http request to all routes */ | |
router("*").all(); | |
// no need for something like this | |
// that's just too much work. | |
{ | |
"permissions": [ | |
{ | |
"resource": "/users", | |
"methods": ["POST", "GET", "PUT"], | |
"action": "allow" | |
}, | |
{ | |
"resource": "/products", | |
"methods": ["POST", "GET", "PUT", "DELETE"], | |
"action": "allow" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment