-
-
Save soroushjp/3226854 to your computer and use it in GitHub Desktop.
Node Tuts episode 9 - Express
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
var express = require('express'); | |
var app = express.createServer(); | |
app.configure('development', function () { | |
app.use(express.logger()); | |
app.use(express.errorHandler({ | |
dumpExceptions: true, | |
showStack: true | |
})); | |
}); | |
app.configure('production', function () { | |
app.use(express.logger()); | |
app.use(express.errorHandler()); | |
}); | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
app.set('view options', {layout: true}); | |
app.get('/', function(req, res) { | |
res.render('root'); | |
}); | |
app.listen(4000); |
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
!!! 5 | |
html | |
head | |
title My template | |
body | |
h1 Content goes here | |
block content |
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
extends layout | |
block content | |
h2 Hello | |
p World! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment