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
// Index | |
app.get('/', function(req, res) { | |
if (!req.cookies.user) { | |
res.cookie('user', 'zoran.felbar@gmail.com'); | |
// send that cookie is set to layout.jade | |
console.log('Cookie set'); | |
} else { |
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
app.get('/lobby/:id', function(req, res) { | |
db.games.find( { name: req.params.id }, function(err, game) { | |
if (err) { | |
res.render('404', { | |
title: 'Game not found', | |
message: 'Game ' + req.params.id + 'not found' | |
}); | |
console.log('error'); |
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
var url = "url from nodejitsu", | |
coll = ['games'], | |
db = require('mongojs').connect(url, coll); | |
// A user model object | |
function user(username, password, nickname) { | |
this.username = username; | |
this.password = password; | |
this.nickname = nickname; |
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
<div id="loginForm"> | |
Login | |
<form method="POST" action="/sign_in"> | |
<div class="input"><input type="text" name="username" value="Username" id="username" /></div> | |
<div class="input"><input type="text" name="password" value="Password" id="password" /></div> | |
<div><input type="checkbox" name="rememberMe" value="1" id="rememberId" /><label for="rememberId"> Remember me</label></div> | |
<div><a href="">I forgot my password</a></div> | |
<input type="submit" name="submit_login" value=" " id="loginButton" /> | |
</form> | |
</div> |
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
var express = require('express'), | |
nano = require('nano')('http://127.0.0.1:5984/'), | |
db = nano.use('user'); | |
routes = require('./routes'), | |
http = require('http'), | |
path = require('path'); | |
app = express(), | |
server = http.createServer(app), | |
io = require('socket.io').listen(server); | |
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
var express = require('express'), | |
path = require('path'), | |
http = require('http'), | |
app = express(), | |
server = http.createServer(app); | |
//io = require('socket.io').listen(server); | |
app.configure(function() { | |
app.set('port', process.env.PORT || 3000); | |
app.set('views', __dirname + '/views'); |
NewerOlder