Skip to content

Instantly share code, notes, and snippets.

@emilong
Created March 29, 2016 00:55
Show Gist options
  • Save emilong/2f80a07c17727bb2a428 to your computer and use it in GitHub Desktop.
Save emilong/2f80a07c17727bb2a428 to your computer and use it in GitHub Desktop.
// Factory
function createPdfsController(PdfService) {
return {
create: function(req, res, next) {
const content_id = req.params.content_id;
const pdf_id = PdfService.generate(content_id);
res.json({ pdf_id: pdf_id });
}
};
}
// Export a function that registers the service provider with the given container.
modules.export = function(bottle) {
bottle.service(
'controller.Pdfs', // the name of the service we're providing
createPdfsController, // the factory to create the service instance
'service.PdfGenerator' // the dependencies required to create the factory
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment