Last active
December 11, 2015 09:49
-
-
Save darrenderidder/4582833 to your computer and use it in GitHub Desktop.
Route Function Modules Example 1
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
exports.getArticle = function (req, res) { | |
// get article | |
res.send(article); | |
}; | |
exports.postArticle = function (req, res) { | |
// create article (from req.body) | |
}; |
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
var express = require('express'); | |
var app = express(); | |
var articles = require('routes/articles.js'); | |
app.get('/article', articles.getArticle); | |
app.post('/article', articles.postArticle); | |
// etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment