Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to Node 0.4.2 and Express 2.x

  • Loading branch information...
commit 19fbb2e15dd2e247397e9d9d1caea3a4800a865e 1 parent 44241eb
Alex Young authored
View
23 app.js
@@ -1,11 +1,11 @@
-var express = require('express@1.0.7'),
- connect = require('connect@0.5.1'),
- jade = require('jade@0.6.0'),
+var express = require('express@2.0.0beta3'),
+ connect = require('connect@1.0.6'),
+ jade = require('jade@0.8.6'),
app = module.exports = express.createServer(),
- mongoose = require('mongoose@1.0.7'),
- mongoStore = require('connect-mongodb@0.1.1'),
+ mongoose = require('mongoose@1.1.4'),
+ mongoStore = require('connect-mongodb@0.2.1'),
mailer = require('mailer@0.4.52'),
- stylus = require('stylus'),
+ stylus = require('stylus@0.7.4'),
markdown = require('markdown').markdown,
sys = require('sys'),
path = require('path'),
@@ -72,13 +72,13 @@ app.configure('production', function() {
app.configure(function() {
app.set('views', __dirname + '/views');
app.use(express.favicon());
- app.use(express.bodyDecoder());
- app.use(express.cookieDecoder());
+ app.use(express.bodyParser());
+ app.use(express.cookieParser());
app.use(express.session({ store: mongoStore(app.set('db-uri')), secret: 'topsecret' }));
app.use(express.logger({ format: '\x1b[1m:method\x1b[0m \x1b[33m:url\x1b[0m :response-time ms' }))
app.use(express.methodOverride());
app.use(stylus.middleware({ src: __dirname + '/public' }));
- app.use(express.staticProvider(__dirname + '/public'));
+ app.use(express.static(__dirname + '/public'));
app.set('mailOptions', {
host: 'localhost',
port: '25',
@@ -347,10 +347,11 @@ app.post('/sessions', function(req, res) {
var loginToken = new LoginToken({ email: user.email });
loginToken.save(function() {
res.cookie('logintoken', loginToken.cookieValue, { expires: new Date(Date.now() + 2 * 604800000), path: '/' });
+ res.redirect('/documents');
});
+ } else {
+ res.redirect('/documents');
}
-
- res.redirect('/documents');
} else {
req.flash('error', 'Incorrect credentials');
res.redirect('/sessions/new');
View
14 package.json
@@ -8,16 +8,16 @@
"public": "./public"
},
"engines": {
- "node": ">= 0.2.0"
+ "node": ">= 0.4.0"
},
"dependencies": {
- "express": "1.0.7",
- "mongoose": "1.0.7",
- "connect": "0.5.1",
- "connect-mongodb": "0.1.1",
- "jade": "0.6.0",
+ "express": "2.0.0beta3",
+ "mongoose": "1.1.4",
+ "connect": "1.0.6",
+ "connect-mongodb": "0.2.1",
+ "jade": "0.8.6",
"markdown": "0.2.0",
- "stylus": "0.5.1",
+ "stylus": "0.7.4",
"mailer": "0.4.52"
},
"bin": {
View
2  views/documents/edit.jade
@@ -5,5 +5,5 @@ p
form(method='post', action='/documents/' + d.id)
input(name='d[id]', value=d.id, type='hidden')
input(name='_method', value='PUT', type='hidden')
- !=partial('documents/fields', { locals: { d: d } })
+ !=partial('fields', { locals: { d: d } })
View
3  views/partials/documents/fields.jade → views/documents/fields.jade
@@ -4,8 +4,7 @@ div
div
label Note:
div
- textarea(name='d[data]')
- =d.data || ''
+ textarea(name='d[data]')= d.data
div
input(type='submit', value='Save')
View
2  views/documents/new.jade
@@ -3,5 +3,5 @@
p
a.button(href='/documents') ← All Documents
form(method='post', action='/documents')
- !=partial('documents/fields', { locals: { d: d } })
+ !=partial('fields', { locals: { d: d } })
View
2  views/sessions/new.jade
@@ -3,7 +3,7 @@
p
a.button(href='/users/new') Register
form#login(method='post', action='/sessions')
- !=partial('users/fields', { locals: { user: user } })
+ !=partial('../users/fields', { locals: { user: user } })
div
label(for='remember_me') Remember me:
input#remember_me(type='checkbox', name='remember_me')
View
0  views/partials/users/fields.jade → views/users/fields.jade
File renamed without changes
View
2  views/users/new.jade
@@ -2,7 +2,7 @@
h2 Register
form(method='post', action='/users')
- !=partial('users/fields', { locals: { user: user } })
+ !=partial('fields', { locals: { user: user } })
div
input(type='submit', value='Register')
span \ or
Please sign in to comment.
Something went wrong with that request. Please try again.