Skip to content

Commit

Permalink
initializing express
Browse files Browse the repository at this point in the history
  • Loading branch information
chanind committed May 15, 2012
1 parent 60bb0f7 commit 5004c95
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.project
34 changes: 34 additions & 0 deletions app.coffee
@@ -0,0 +1,34 @@

#
# Module dependencies.
#

express = require('express')
routes = require('./routes')

app = module.exports = express.createServer()

# Configuration

app.configure ->
app.set('views', __dirname + '/views')
app.set('view engine', 'jade')
app.use(express.bodyParser())
app.use(express.methodOverride())
app.use(app.router)
app.use(express.static(__dirname + '/public'))


app.configure 'development', ->
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }))


app.configure 'production', ->
app.use(express.errorHandler())

# Routes

app.get('/', routes.index)

app.listen(3000)
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env)
9 changes: 9 additions & 0 deletions package.json
@@ -0,0 +1,9 @@
{
"name": "nodechat"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"express": "2.5.8"
, "jade": ">= 0.0.1"
}
}
8 changes: 8 additions & 0 deletions public/stylesheets/style.css
@@ -0,0 +1,8 @@
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}

a {
color: #00B7FF;
}
8 changes: 8 additions & 0 deletions routes/index.js
@@ -0,0 +1,8 @@

/*
* GET home page.
*/

exports.index = function(req, res){
res.render('index', { title: 'Express' })
};
2 changes: 2 additions & 0 deletions views/index.jade
@@ -0,0 +1,2 @@
h1= title
p Welcome to #{title}
6 changes: 6 additions & 0 deletions views/layout.jade
@@ -0,0 +1,6 @@
!!!
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body!= body

0 comments on commit 5004c95

Please sign in to comment.