This file contains hidden or 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'); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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', '[email protected]'); | |
// send that cookie is set to layout.jade | |
console.log('Cookie set'); | |
} else { |
This file contains hidden or 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
db.users.findOne({username:"someuser_not_found"}, function(err, doc) { | |
if (err) { | |
console.log(err); | |
} | |
if (doc) { | |
console.log("Success" + doc.username); | |
} else { |
This file contains hidden or 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'), | |
url = "mongodb://nodejitsu_zoranf:[email protected]:51947/nodejitsu_zoranf_nodejitsudb8036041315", | |
coll = ['users', 'games'], | |
db = require('mongojs').connect(url, coll) | |
http = require('http'), | |
path = require('path'); | |
app = express(), | |
server = http.createServer(app), | |
io = require('socket.io').listen(server); | |
This file contains hidden or 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
extends layout | |
block content | |
title= title | |
h1 Let the game begin | |
p Hops, lets play | |
#platform.snops | |
#chat | |
ul#messages | |
input(type='text', name='input_message', value='Message', id='input') |
This file contains hidden or 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
/* SCORE */ | |
#score-box { | |
position: absolute; | |
right: 0px; | |
top: 0px; | |
height: 100%; | |
background: #dde4eb; | |
color: #35383f; | |
border-left: 1px solid #b2b9c2; | |
width: 300px; |
OlderNewer