Skip to content
Permalink
Browse files

Creation d'une application Express

  • Loading branch information...
cexbrayat committed Aug 21, 2011
0 parents commit b5290065e369d45c1e4d15ec3e6b4f6062de396e
Showing with 63 additions and 0 deletions.
  1. +38 −0 app.js
  2. +9 −0 package.json
  3. +8 −0 public/stylesheets/style.css
  4. +2 −0 views/index.jade
  5. +6 −0 views/layout.jade
38 app.js
@@ -0,0 +1,38 @@

/**
* Module dependencies.
*/

var express = require('express');

var app = module.exports = express.createServer();

// Configuration

app.configure(function(){
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', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

app.configure('production', function(){
app.use(express.errorHandler());
});

// Routes

app.get('/', function(req, res){
res.render('index', {
title: 'Express'
});
});

app.listen(3000);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
@@ -0,0 +1,9 @@
{
"name": "application-name"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"express": "2.4.3"
, "jade": ">= 0.0.1"
}
}
@@ -0,0 +1,8 @@
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}

a {
color: #00B7FF;
}
@@ -0,0 +1,2 @@
h1= title
p Welcome to #{title}
@@ -0,0 +1,6 @@
!!!
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body!= body

0 comments on commit b529006

Please sign in to comment.
You can’t perform that action at this time.