Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Removed blog, added login.
Added dependence on connect-flash to allow for flash messages.
- Loading branch information
Showing
8 changed files
with
65 additions
and
24 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = function(){ | ||
module.exports = function(app){ | ||
var viewsDir = "home/"; | ||
|
||
return{ | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = function(app){ | ||
var viewsDir = "login/"; | ||
|
||
return{ | ||
loginGET : function(req, res, next){ | ||
//display the login form | ||
req.flash('info', "You are logged in"); | ||
res.render(viewsDir + "index"); | ||
}, | ||
loginPOST : function(req, res, next){ | ||
//process the login post | ||
res.render(viewsDir + "index"); | ||
}, | ||
logout : function(req, res, next){ | ||
//logout | ||
res.render(viewsDir + "index"); | ||
}, | ||
getUser : function(req, res, next){ | ||
//load the user for the current session | ||
|
||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
var flash = require("connect-flash"); | ||
var express = require("express"); | ||
|
||
module.exports = function(app){ | ||
app.use(app.router); | ||
app.use(express.static(__dirname + '/../public')); | ||
app.use(express.errorHandler()); | ||
app.configure(function(){ | ||
//enable our view engine | ||
app.set('views', __dirname + '/../views'); | ||
app.set('view engine', 'jade'); | ||
|
||
app.use(express.cookieParser('keyboard cat')); | ||
app.use(express.session({ cookie: { maxAge: 60000 }})); | ||
app.use(flash()); | ||
|
||
app.use(function(req, res, next) { | ||
res.locals.flash = function() { return req.flash() }; | ||
next(); | ||
}); | ||
|
||
app.use(app.router); | ||
app.use(express.static(__dirname + '/../public')); | ||
app.use(express.errorHandler()); | ||
}); | ||
|
||
// Optional since express defaults to CWD/views | ||
app.set('views', __dirname + '/../views'); | ||
|
||
// Set our default template engine to "jade" | ||
// which prevents the need for extensions | ||
// (although you can still mix and match) | ||
app.set('view engine', 'jade'); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
html | ||
head | ||
block head | ||
body | ||
- msg = flash(); | ||
if(msg) | ||
if(msg.error) | ||
p.error= msg.error | ||
if(msg.info) | ||
p.info= msg.info | ||
h1 Title | ||
block body |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
extends ../_layout | ||
|
||
block head | ||
|
||
block body | ||
p Hello World |
This file contains 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