Skip to content

Instantly share code, notes, and snippets.

@hellobrian
Created January 14, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellobrian/4aba8f7ad21d97cdbf1b to your computer and use it in GitHub Desktop.
Save hellobrian/4aba8f7ad21d97cdbf1b to your computer and use it in GitHub Desktop.
server.js zones
// 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