1//Using Express 4, in your app.js file you can use
2app.set('socketio', io);
3
4//then in your router you can access it like this
5router.post('/getRides', function(req, res, next) {
6 var io = req.app.get('socketio');
7
8 io.to(//socket.id//).emit("message", data);
9
10 db.rides.find(function(err, docs) {
11 res.json(docs);
12 });
13};
1router.post('/getRides', function(req, res, next) {
2 var io = req.app.get('socketio');
3
4 io.to(//socket.id//).emit("message", data);
5
6 db.rides.find(function(err, docs) {
7 res.json(docs);
8 });
9};