-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathplugins.js
39 lines (36 loc) · 999 Bytes
/
plugins.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
'use strict'
const path = require('path')
module.exports = [
// MiddleWares
require('./src/middlewares/requestId')(),
require('./src/middlewares/responseHandler')(),
require('./src/middlewares/countRequest')(),
// Mail Error
require('./src/middlewares/MailError')(),
// Basic Plugins
require('koa-helmet')(),
require('koa-query-pretty')(),
require('koa-json')(),
require('koa-jsonp')(),
require('koa-bodyparser')({
enableTypes: ['json', 'form'],
formLimit: '10mb',
jsonLimit: '10mb'
}),
require('kcors')({
origin: '*',
allowMethods: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH'],
exposeHeaders: ['X-Request-Id']
}),
require('koa-favicon')(path.join(__dirname, './public/favicon.ico')),
require('koa-compress')({
filter: (contentType) => {
return /text/i.test(contentType)
},
threshold: 2048,
flush: require('zlib').Z_SYNC_FLUSH
}),
require('./src/logger')(),
// Dev Plugins
require('koa-livereload')()
]