Created
January 14, 2015 19:59
-
-
Save hellobrian/4aba8f7ad21d97cdbf1b to your computer and use it in GitHub Desktop.
server.js zones
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
// Commented code is for express router and hbs templates | |
var express = require('express'); | |
var app = express(); | |
app.use(express.static(__dirname + '/', { extensions: ['html'] })); | |
// var hbs = require('express-handlebars'); | |
// var path = require('path'); | |
var router = express.Router(); | |
// var handlebars = hbs.create({ | |
// defaultLayout: 'layout', | |
// extname: '.html' | |
// }); | |
// app.engine('html', handlebars.engine); | |
// app.set('view engine', 'html'); | |
// app.set('views', path.join(__dirname, 'views')); | |
// app.use(express.static(path.join(__dirname, 'public'))); | |
// router.get('/', function(req, res) { | |
// res.render('index'); | |
// }); | |
// | |
// router.get('/cognitive', function(req, res) { | |
// res.render('cognitive'); | |
router.get('/', function(req, res) { | |
res.sendFile('index.html'); | |
}) | |
router.get('/cognitive', function(req, res) { | |
res.sendFile('cognitive.html'); | |
}); | |
// | |
// router.get('/cognitive', function(req, res) { | |
// res.render('cognitive'); | |
// }); | |
router.get('/', function(req, res) { | |
res.sendFile('index.html'); | |
}) | |
router.get('/cognitive', function(req, res) { | |
res.sendFile('cognitive.html'); | |
}); | |
app.use('/', router); | |
var host = (process.env.VCAP_APP_HOST || 'localhost'); | |
var port = (process.env.VCAP_APP_PORT || 3001); | |
app.listen(port, host); | |
console.log('App started on port ' + port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment