-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added submodules: connect, optimist, mongoose
- Loading branch information
Showing
11 changed files
with
57 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[submodule "lib/mongoose"] | ||
path = lib/mongoose | ||
url = git://github.com/LearnBoost/mongoose.git | ||
[submodule "lib/socket.io"] | ||
path = lib/socket.io | ||
url = git://github.com/LearnBoost/Socket.IO-node.git | ||
[submodule "lib/connect"] | ||
path = lib/connect | ||
url = git://github.com/senchalabs/connect.git | ||
[submodule "lib/optimist"] | ||
path = lib/optimist | ||
url = git://github.com/substack/node-optimist.git |
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,6 +1,12 @@ | ||
// This file will create database connection | ||
// And call "fn" when connection is ready | ||
module.exports = function(fn) { | ||
var db = {}; | ||
fn && fn(db); | ||
var mongoose = require('../lib/mongoose/mongoose').Mongoose, | ||
db = mongoose.connect('mongodb://localhost/mapchat'); | ||
|
||
db.mongoose = mongoose; | ||
db.models = {}; | ||
db.on('open', function() { | ||
fn(db) | ||
}); | ||
}; |
Submodule connect
added at
434fe8
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
Submodule mongoose
added at
45a591
Submodule optimist
added at
56b2b1
Submodule socket.io
added at
562053
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Initiates point model | ||
*/ | ||
|
||
db.mongoose.model({ | ||
properties: ['location', 'topic', 'author_id', 'updated_at'], | ||
indexes: { | ||
'location': '2d', | ||
'updated_at': -1, | ||
'author_id': 1 | ||
} | ||
}); | ||
|
||
var Point = db.models.Point = db.model('User'); | ||
|
||
exports.routes = function(app) { | ||
app.get('/point/:id', function(req, res) { | ||
var point = Point.find({_id: req.params.id}).first(function(point) { | ||
if (!point) { | ||
res.writeHead(404); | ||
res.end(); | ||
return; | ||
} | ||
res.writeHead(200); | ||
res.write(point.toJSON()); | ||
}); | ||
}); | ||
}; |
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