Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Ottis = require('../lib');
- const router = Ottis.router;
- const auth = Ottis({
- users: [
- "admin",
- "customer"
- ]
- });
- /* Admin Config */
- auth .addConfigFor('admin')
- .forResource('customers')({
- config: [router().all()]
- })
- .forResource('anonymous-customers')({
- config: [router().all()]
- })
- .forResource('products')({
- config: [
- router("/").get().post().done(),
- router("/:id").get().put().delete().done(),
- router("/:id/location/:name").get().done()
- ]
- })
- /* Customer Config */
- auth.addConfigFor('customer')
- .forResource('customers')({
- config: [
- router("/me").get().put().delete().done()
- ]
- })
- .forResource('anonymous-customers')({
- config: [
- router("/:id").get().done()
- ]
- })
- .forResource('products')({
- config: [
- router("/").get().done(),
- router("/:id").get().done(),
- ]
- })
- module.exports = auth.User;
Add Comment
Please, Sign In to add comment