runs controller

master
Matt Huntington 9 years ago
parent 0188c04655
commit 41086b299b

@ -0,0 +1,12 @@
var express = require('express');
var controller = express.Router();
controller.get('/', function(req, res){
res.send('inside runs controller: index route');
});
controller.get('/new', function(req, res){
res.send('inside runs controller: new route');
});
module.exports = controller;

@ -3,20 +3,8 @@ var app = express(); //create application variable
var fakeArray = require('./models/fakearray.js');
var PORT = process.env.PORT || 3000;
app.use(function(req, res, next){
console.log('middleware doin. stuff');
next();
});
app.use(function(req, res, next){
console.log('2nd middleware doin. stuff');
next();
});
app.use('/foo', function(req, res, next){
console.log('3rd middleware doin. stuff');
next();
});
var runController = require('./controllers/runs.js');
app.use('/runs', runController);
app.get('/', function(request, response){
response.render('index.ejs', {
@ -24,14 +12,6 @@ app.get('/', function(request, response){
});
});
app.get('/foo', function(req, res){
res.send('works');
});
app.get('/foo/bar', function(req, res){
res.send('works');
});
//params: port, callback to execute once listening has begun
app.listen(PORT, function () { //start app listening on port 3000
//once listening, execute this callback

Loading…
Cancel
Save