Created
October 18, 2013 02:55
-
-
Save beresmate/7035808 to your computer and use it in GitHub Desktop.
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
/* global module, require */ | |
(function () { | |
'use strict'; | |
var library = require('./../app/controllers/library'), | |
views = require('./../app/controllers/views'), | |
_ = require('lodash'); | |
module.exports = function (app, io) { | |
var ioMixin = function (req, res, next, fn) { | |
io.sockets.once('connection', function (socket) { | |
fn(req, res, socket); | |
}); | |
}; | |
var withIO = function (fn) { | |
return _.partialRight(ioMixin, library.update); | |
}; | |
app.get('/', views.index); | |
app.get('/api/tracks', library.list); | |
app.get('/api/updatelib', withIO(library.update)); | |
}; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment