-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
24 lines (17 loc) · 676 Bytes
/
index.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
const express = require('express')
const path = require('path')
const proxy = require('http-proxy-middleware')
const proxyOptions = require('./package').proxy
const app = express()
const APIKEY = process.env.TSI_API_KEY
apiProxy = proxyOptions['/api']
apiProxy.headers['TekSavvy-APIKey'] = APIKEY
app.get('/api/*', proxy(apiProxy))
app.use(express.static(path.join(__dirname, 'build')))
app.get('/', function (req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'))
})
const server = app.listen(3000, () => { console.info('\x1b[33m%s\x1b[0m', `[express] Listening on ${server.address().port}`) })
process.on('SIGINT', function() {
process.exit();
});