summaryrefslogtreecommitdiff
path: root/src/services/meal/index.js
blob: f99aadae87f46fb35f1ebd8853b2623adacc0dec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';

const service = require('feathers-sequelize');
const meal = require('./meal-model');
const hooks = require('./hooks');

module.exports = function(){
  const app = this;

  const options = {
    Model: meal(app.get('sequelize')),
    paginate: {
      default: 100,
      max: 100,
    }
  };

  // Initialize our service with any options it requires
  app.use('/meals', service(options));

  // Get our initialize service to that we can bind hooks
  const mealService = app.service('/meals');

  // Set up our before hooks
  mealService.before(hooks.before);

  // Set up our after hooks
  mealService.after(hooks.after);
};