Permalink
Browse files

Merge pull request #2 from cacois/master

Updated code to work with Express 3.x
  • Loading branch information...
2 parents d83542f + 2598d3d commit 7b3df95fdfdc1316d320090a596f0db669173fe9 @seafoox committed Feb 13, 2013
Showing 397 changed files with 42,401 additions and 1,220 deletions.
View
@@ -1,9 +1,7 @@
-# Project folders #
-###################
-node_modules/
+# Project folders
+node_modules/ # remove this line if you want to check your modules into version control
-# OS generated files #
-######################
+# OS generated files
.DS_Store*
ehthumbs.db
Icon?
View
@@ -1,16 +1,12 @@
-# NodeJS Boostrap using Express / EJS / Twitter Bootstrap / Responsive CSS3
+# Node.js Boostrap using Express 3.x / EJS / Twitter Bootstrap / Responsive CSS3
-## Prerequisites
+## Getting Started
-- npm install express
-- npm install ejs
-
-## Starting
-
-- git clone https://github.com/seafoox/node-express-twitter-bootstrap.git
+- git clone https://github.com/cacois/node-express-twitter-bootstrap.git
- cd node-express-twitter-bootstrap
+- npm install express ejs ejs-locals
- node server.js
## Changelog:
-### v.0.1 : February 28th, 2012
+### v.0.2 : October 15th, 2012
View
41 app.js
@@ -1,35 +1,44 @@
-var express = require('express');
-var app = express.createServer();
+/*
+ * app.js
+ *
+ * Our base app code, including Express configs
+ */
+
+var express = require('express')
+ , engine = require('ejs-locals')
+ , app = express();
exports.init = function(port) {
app.configure(function(){
- app.set('views', __dirname + '/views');
- app.set('view engine', 'ejs');
- app.use(express.bodyParser());
- app.use(express.methodOverride());
- app.use(express.static(__dirname + '/static'));
- app.use(app.router);
- app.enable("jsonp callback");
+ app.set('views', __dirname + '/views');
+ app.set('view engine', 'ejs');
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(express.static(__dirname + '/static'));
+ app.use(app.router);
+ app.enable("jsonp callback");
});
+ app.engine('ejs', engine);
+
app.configure('development', function(){
- app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
// app.use(express.logger({ format: ':method :url' }));
});
app.configure('production', function(){
- app.use(express.errorHandler());
+ app.use(express.errorHandler());
});
- app.error(function(err, req, res, next){
- res.render('500.ejs', { locals: { error: err },status: 500 });
+ app.use( function(err, req, res, next) {
+ res.render('500.ejs', { locals: { error: err }, status: 500 });
});
+
+ server = app.listen(port);
- app.listen(port);
-
- console.log("Listening on port %d in %s mode", app.address().port, app.settings.env);
+ console.log("Listening on port %d in %s mode", server.address().port, app.settings.env);
return app;
}
Oops, something went wrong.

0 comments on commit 7b3df95

Please sign in to comment.