how is socket.io different from express routing code example
Example 1: how to use of socket io on a route in nodejs
app.set('socketio', io);
router.post('/getRides', function(req, res, next) {
var io = req.app.get('socketio');
io.to(
db.rides.find(function(err, docs) {
res.json(docs);
});
};
Example 2: how to use of socket io on a route in nodejs
router.post('/getRides', function(req, res, next) {
var io = req.app.get('socketio');
io.to(
db.rides.find(function(err, docs) {
res.json(docs);
});
};