category.js 358 B

12345678910111213
  1. var models = require('../models');
  2. var Category = models.Category;
  3. module.exports = function(app) {
  4. // Return a list of available node types
  5. app.get('/categories', function(req, res) {
  6. models.sequelize.sync().on('success', function() {
  7. Category.findAll().success(function(categories) {
  8. res.json(categories);
  9. });
  10. });
  11. });
  12. };