Skip to content

Instantly share code, notes, and snippets.

@w3cj
Created December 7, 2015 18:24
Show Gist options
  • Select an option

  • Save w3cj/0e976025a7752f8675c8 to your computer and use it in GitHub Desktop.

Select an option

Save w3cj/0e976025a7752f8675c8 to your computer and use it in GitHub Desktop.
var express = require('express');
var app = express();
app.set('view engine', 'jade');
app.get('/', function(request, response){
response.render('index', { title: 'Hey', message: 'Bye World'})
// var options = {
// root: __dirname,
// dotfiles: 'deny',
// headers: {
// 'x-timestamp': Date.now(),
// 'x-sent': true
// }
// };
// response.sendFile('index.html', options, function(err){
// if (err) {
// console.log(err);
// response.status(err.status).end();
// }
// else {
// console.log('Sent:', fileName);
// }
// });
})
app.get('/name/:name', function(request, response){
console.log(request);
response.send('Hello ' + request.params.name)
});
app.get('/cohorts/:id/daily_plans/:date', function(request, response){
console.log(request);
response.send(request.params.id + ' ' + request.params.date);
});
app.listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment