Skip to content

Instantly share code, notes, and snippets.

@NizarOukhchi
Last active February 26, 2016 12:07
Show Gist options
  • Save NizarOukhchi/5a4dddf907a95d35ecb8 to your computer and use it in GitHub Desktop.
Save NizarOukhchi/5a4dddf907a95d35ecb8 to your computer and use it in GitHub Desktop.
Create model and broadcast it (before)
/* app/server/api/model/model.controller.js */
var Model = require('./model');
exports.create = function (req, res) {
Model.create(req.body, function (err, model) {
if (err) {
return res.status(500).send(err);
}
// "broadcaster" le model crée a tout le monde via socket.io
return res.status(201).json(model);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment