Helper devserver, serve static files and proxy to api/tileserver
This commit is contained in:
parent
d5654e4e1e
commit
ca4e569bd1
17
devserver/index.js
Normal file
17
devserver/index.js
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Dev server for local development
|
||||
* - serve static files from frontend
|
||||
* - proxy /api calls to 8081
|
||||
* - proxy /tiles calls to 8082
|
||||
*/
|
||||
const path = require('path')
|
||||
|
||||
const express = require('express')
|
||||
const proxy = require('express-http-proxy');
|
||||
|
||||
const app = express()
|
||||
app.use(express.static(path.join(__dirname, '..', 'frontend')))
|
||||
app.use('/api', proxy('localhost:8081'))
|
||||
app.use('/tiles', proxy('localhost:8082'))
|
||||
|
||||
app.listen(8080, () => console.log('Dev server listening on port 8080...'))
|
17
devserver/package.json
Normal file
17
devserver/package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "cl-devserver",
|
||||
"version": "1.0.0",
|
||||
"description": "Development server to proxy",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"debug": "DEBUG=express:* node index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Tom Russell",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"express": "^4.16.3",
|
||||
"express-http-proxy": "^1.2.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user