-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (29 loc) · 988 Bytes
/
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
'use strict'
const express = require('express')
const app = express()
const authenticate = require('./routes/authenticate')
const libraries = require('./routes/libraries')
const schemas = require('./routes/schemas')
const services = require('./routes/services')
require('dotenv').config()
require('dotenv-defaults').config()
// Allow cross origin
app.use(function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*')
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept, Authorization'
)
res.header('Access-Control-Allow-Methods', 'POST, PUT, GET, OPTIONS')
next()
})
app.use(express.urlencoded({ extended: false }))
app.use(express.json())
app.use(express.text({ type: 'text/csv' }))
app.use('/authenticate', authenticate)
app.use('/libraries', libraries)
app.use('/schemas', schemas)
app.use('/services', services)
const port = process.env.PORT || 3000
const server = app.listen(port)
server.timeout = 240000