-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from emersonmellado/master
Adjusting expiration time to be 7 days
- Loading branch information
Showing
2 changed files
with
13 additions
and
11 deletions.
There are no files selected for viewing
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,17 @@ | ||
var port = process.env.PORT || 1337; // let heroku define port or use 1337 | ||
var http = require('http'); // core node.js http (no frameworks) | ||
var url = require('url'); // core node.js url (no frameworks) | ||
var app = require('./lib/helpers'); // auth, token verification & render helpers | ||
var c = function(res){ /* */ }; | ||
|
||
http.createServer(function (req, res) { | ||
var url = req.url; | ||
if( url === '/' || url === '/home' ) { app.home(res); } // homepage | ||
else if( url === '/auth') { app.handler(req, res); } // authenticator | ||
else if( url === '/private') { app.validate(req, res, app.done); } // private content | ||
else if( url === '/logout') { app.logout(req, res, app.done); } // end session | ||
else if( url === '/exit') { app.exit(res); } // for testing ONLY | ||
else { app.notFound(res); } // 404 error | ||
var path = url.parse(req.url).pathname; | ||
if( path === '/' || path === '/home' ) { app.home(res); } // homepage | ||
else if( path === '/auth') { app.handler(req, res); } // authenticator | ||
else if( path === '/private') { app.validate(req, res, app.done); } // private content | ||
else if( path === '/logout') { app.logout(req, res, app.done); } // end session | ||
else if( path === '/exit') { app.exit(res); } // for testing ONLY | ||
else { app.notFound(res); } // 404 error | ||
}).listen(port); | ||
|
||
console.log("Visit: http://127.0.0.1:" + port); |