-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
38 lines (31 loc) · 1.06 KB
/
app.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
27
28
29
30
31
32
33
34
35
36
37
38
import express from 'express';
import path from 'path';
import favicon from 'serve-favicon';
import logger from 'morgan';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import index from './routes/index';
import graphql from './routes/graphql';
import pushNotification from './routes/pushNotification';
import fcm from './routes/fcm';
import { notFound, errorHandler } from './functions/app';
const app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
// uncomment after placing your favicon in /public
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', index);
app.use('/graphql', graphql);
app.use('/pushNotification', pushNotification);
app.use('/fcm', fcm);
// catch 404
app.use(notFound);
// forward to error handler
app.use(errorHandler);
export default app;