-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
62 lines (54 loc) · 1.7 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const express = require('express');
const { graphqlUploadExpress } = require('graphql-upload');
// const { altairKoa } = require('altair-koa-middleware');
// const logger = require('pino-http')({
// prettyPrint: true
// });
const app = express();
app.use(express.json());
app.use(
graphqlUploadExpress({
maxFileSize: 90000000, // 90 MB
maxFiles: 20
})
);
app.use('/static', express.static('uploads'));
// const addUser = async (req, res, next) => {
// const token = req.headers['x-token'];
// if (token) {
// try {
// const { user } = jwt.verify(token, SECRET);
// req.user = user;
// } catch (err) {
// const refreshToken = req.headers['x-refresh-token'];
// const newTokens = await refreshTokens(
// token,
// refreshToken,
// models,
// SECRET,
// SECRET2
// );
// if (newTokens.token && newTokens.refreshToken) {
// res.set(
// 'Access-Control-Expose-Headers',
// 'x-token, x-refresh-token'
// );
// res.set('x-token', newTokens.token);
// res.set('x-refresh-token', newTokens.refreshToken);
// }
// req.user = newTokens.user;
// }
// }
// next();
// };
// global error handling middleware
// app.use(errorController);
// app.use(
// '/graphiql',
// altairExpress({
// endpointURL: '/graphql',
// subscriptionsEndpoint: `ws://localhost:5000/subscriptions`
// // initialQuery: `{ getData { id name surname } }`
// })
// );
module.exports = app;