summaryrefslogtreecommitdiff
path: root/src/services/meal/index.js
blob: 88ca1bda48dec8958559ecf5b6cd9b576713299d (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: 5,
      max: 25
    }
  };

  // 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);
};