-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
executable file
·33 lines (27 loc) · 1.2 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
const express = require('express');
const compression = require('compression');
const morgan = require('morgan');
const helmet = require('helmet');
const cors = require('cors');
const workspaceRouter = require('./routes/workspace.route')
const featureTypeRouter = require('./routes/featureType.route')
const dataStoreRouter = require('./routes/datastore.route')
const layerRouter = require('./routes/layer.route')
const styleRouter = require('./routes/style.route')
const layerGroupRouter = require('./routes/layer-group.route')
const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/config/config.json');
const basePath = config.basePath;
const app = express()
app.use(cors())
app.use(compression({}))
app.use(helmet())
app.use(morgan((env === 'development' ? 'dev' : 'combined'), {}))
app.use(express.json({limit: '200mb', inflate: true, strict: true, type: 'application/json'}))
app.use(basePath + '/workspace', workspaceRouter)
app.use(basePath + '/featuretype', featureTypeRouter)
app.use(basePath + '/datastore', dataStoreRouter)
app.use(basePath + '/layer', layerRouter)
app.use(basePath + '/layergroup', layerGroupRouter)
app.use(basePath + '/style', styleRouter)
module.exports = app