choochootrain
0 Likes Commentsjavascript
var express = require("express");
var ejs = require("ejs");
var app = express();
///////////////////////////////////////////////////////////////////////////////
// APP CONFIGURATION //
///////////////////////////////////////////////////////////////////////////////
//configure logging
app.use(express.logger());
//make files in static folder publicly accessible
app.use('/static', express.static(__dirname + '/static'));
//use ejs for html templates
app.engine('html', ejs.renderFile);
///////////////////////////////////////////////////////////////////////////////
// APP ROUTES //
///////////////////////////////////////////////////////////////////////////////
//default route
app.get('/', function(req, res) {
res.render('index.html', { });
});
app.get('/test', function(req, res) {
res.render('test.html', { });
});
app.get('/ball', function(req, res) {
res.render('ball.html', { });
});
///////////////////////////////////////////////////////////////////////////////
// RUN CONFIGURATION //
///////////////////////////////////////////////////////////////////////////////
var port = Number(process.env.PORT || 5000);
app.listen(port, function() {
console.log("Listening on " + port);
});