aboutsummaryrefslogtreecommitdiff
path: root/services/index.ts
blob: 1763a17c51812bd270f400e1e7c2c796f46ad093 (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
30
import { Application } from '@feathersjs/express';
import Users from './users/users.service';
import Polls from './polls/polls.service';
import Profiles from './profiles/profiles.service';
import Votes from './votes/votes.service';
import Auth from './auth/auth.service';
import Feed from './feed/feed.service';

import tryAuthenticate from '../hooks/tryAuthenticate';
import logging from '../hooks/logging';
import handleErrors from '../hooks/handleErrors';

export default (app: Application): void => {
  app.configure(Auth);
  app.configure(Users);
  app.configure(Polls);
  app.configure(Profiles);
  app.configure(Votes);
  app.configure(Feed);

  app.hooks({
    before: {
      all: [tryAuthenticate, logging]
    },
    error: {
      all: handleErrors
    }
  });
};