aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/services/posts/posts.service.js
blob: cacde6e5f53d0bfffc07de55e5902f99c3ce0631 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Initializes the `posts` service on path `/posts`
const createService = require('feathers-sequelize');
const createModel = require('../../models/posts.model');
const hooks = require('./posts.hooks');

module.exports = function (app) {
  const Model = createModel(app);
  const paginate = app.get('paginate');

  const options = {
    Model,
    paginate
  };

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

  // Get our initialized service so that we can register hooks
  const service = app.service('posts');

  service.hooks(hooks);
};