Created
January 3, 2017 22:53
-
-
Save nisargap/690b586d9d01cf33984364f4eef8c106 to your computer and use it in GitHub Desktop.
IndexRoute.js
This file contains 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
// import in express | |
var express = require('express'); | |
// get the express router | |
var router = express.Router(); | |
// can also get this from another file | |
// var IndexRouteController = require('PATH TO INDEX ROUTE CONTROLLER" | |
var IndexRouteController = function(req, res) { | |
res.render('index', { | |
title: 'MEAN MVC' | |
}); | |
} | |
// define routes for the express router | |
router.get('/', IndexRouteController); | |
// export the router | |
module.exports = router; | |
// Now in app.js | |
// You can var IndexRoute = require('PATH TO THIS FILE'); | |
// app.use(IndexRoute); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment