-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
26 lines (23 loc) · 996 Bytes
/
routes.js
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
'use strict';
const { redirects } = require('./configuration');
const { validation, Filemaker, image, authentication } = require('./services');
const _ = require('lodash');
const bodyParser = require('body-parser');
const boom = require('express-boom');
const mongoSanitize = require('express-mongo-sanitize');
const sanitize = require('express-sanitize-escape');
module.exports = app => {
app.use(boom());
app.use(bodyParser.json());
app.use(mongoSanitize());
app.use(sanitize.middleware());
authentication.setup();
app.use('/authentication', require('./authentication'));
app.use('/api/accounts', require('./api/accounts'));
app.use('/api/faces', require('./api/faces'));
app
.route('/health')
.get((req, res) => res.status(200).json({ message: 'Failing to fetch me at first, keep encouraged. Missing me one place, search another. I stop somewhere waiting for you.' }));
app.use(validation.errors);
app.all('*', (req, res) => res.redirect(redirects.url));
};