Last active
May 29, 2017 20:27
-
-
Save uzumaki-narut0/4824e7d170902bdd77ab6660ffc1bedd to your computer and use it in GitHub Desktop.
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
var express = require('express'); | |
var path = require('path'); | |
var app = express(); | |
var http = require('http').Server(app); | |
var io = require('socket.io')(http); //socket server which integrates with (mounts on) http server | |
var hbs = require('express-handlebars'); | |
var handlebars = require('handlebars'); | |
var helpers = require('handlebars-form-helpers').register(handlebars); | |
//app.use(express.static('public')); | |
app.use(express.static(__dirname + '/public')); | |
var portnumber = process.env.PORT || 8080; | |
app.engine('hbs',hbs({extname: 'hbs', defaultLayout: 'layout', layoutsDir: __dirname+'/views'}));//first argument is engine name which can be anything | |
app.set('views', path.join(__dirname, 'views')); | |
app.set('view engine', 'hbs'); | |
app.get('/', function(req, res){ | |
res.render('home_page'); | |
}); | |
app.get('/:id/:playas',function(req,res){ | |
console.log(req.params); | |
res.render('index', {id: req.params.id, | |
playas: req.params.playas | |
}); | |
//res.status(200).send(html); | |
}) | |
http.listen(portnumber, function(){ | |
console.log('listening on *:8080'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment