summaryrefslogtreecommitdiffstats
path: root/protoype/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'protoype/app.js')
-rw-r--r--protoype/app.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/protoype/app.js b/protoype/app.js
index 2d55388..57d2f86 100644
--- a/protoype/app.js
+++ b/protoype/app.js
@@ -15,8 +15,9 @@ var crypto = require('crypto')
var driver = require('./router/driver.js');
/* var activeusers = require('./activeusers'); */
var connected_clients = {};
+var path = require('path');
-var app = express.createServer();
+var app = express();
app.configure(function() {
app.set('views', __dirname + '/views');
@@ -30,7 +31,8 @@ app.configure(function() {
app.use(express.cookieParser()); /* req.session can be populated with user defined vars */
app.use(express.session({ secret: "keyboard cat", store: new RedisStore() }));
app.use(app.router);
- app.use(express.static(__dirname + '/public'));
+ app.use(require('stylus').middleware(__dirname + '/public'));
+ app.use(express.static(path.join(__dirname, 'public')));
});
app.post('/create', function(req, res) {
@@ -47,6 +49,10 @@ app.post('/create', function(req, res) {
res.redirect('/');
});
+/*
+ * tets drive: curl -d 'tag=unclescotty&id=brotato' localhost:8081/login
+ *
+ */
app.post('/login', function(req, res) {
db.users.find({tag: req.param('tag')}, function(err, thing) {
if (err || !thing || thing.length == 0) {
@@ -131,10 +137,8 @@ app.get('/', function(req, res) {
util.log('[index pn] nothing in db or error retrieving');
res.render('index', {
- locals: {
title: 'Challenger 2.0',
users: items
- }
});
});
});
@@ -143,7 +147,7 @@ app.get('/', function(req, res) {
app.get('/newuser', driver.newuser);
app.listen(8081, function() {
- util.log(util.format('[server] listening on port %d in %s mode', this.address().port, this.settings.env));
+ util.log(util.format('[server] listening on port %d in %s mode', this.address().port, app.settings.env));
})
.on('error', function(e) {
util.log('[server] failed creating server, errno: ' + e.errno);