Last active
August 29, 2015 14:23
-
-
Save fivetanley/50607b163ff8ddafa24d 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
function yoloREST(resourceName, controller) { | |
var express = require('express'); | |
var app = express(); | |
app.get(`/${resourceName}/:id`, controller.show); | |
app.get(`/${resourceName}`, controller.index); | |
app.put(`/${resourceName}/:id`, controller.update); | |
app.post(`/${resourceName}`, controller.create); | |
return app; | |
} | |
yoloREST('swag', { | |
show: (req, res) => { }, | |
index: (req, res) => { }, | |
update: (req, res) => { }, | |
post: (req, res) => { }, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment