add ports to config + bind only to localhost
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
const config = {
|
const config = {
|
||||||
|
devPort: 15800,
|
||||||
|
servicePort: 15801,
|
||||||
urlPrefix: "/mhd",
|
urlPrefix: "/mhd",
|
||||||
openDataKey: 'INSERT_YOUR_OPENDATA_API_KEY_HERE',
|
openDataKey: 'INSERT_YOUR_OPENDATA_API_KEY_HERE',
|
||||||
database: {
|
database: {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import SocketHandler from "./SocketHandler.js";
|
|||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
const devPort = 5000;
|
const devPort = config.devPort;
|
||||||
const servicePort = 5001;
|
const servicePort = config.servicePort;
|
||||||
const staticFilePath = './static'
|
const staticFilePath = './static'
|
||||||
|
|
||||||
// Development Server Settings
|
// Development Server Settings
|
||||||
@@ -26,6 +26,7 @@ const frontEndDevServerOptions = {
|
|||||||
mode: 'development',
|
mode: 'development',
|
||||||
logLevel: 4,
|
logLevel: 4,
|
||||||
serveOptions: {
|
serveOptions: {
|
||||||
|
host: '127.0.0.1',
|
||||||
port: devPort,
|
port: devPort,
|
||||||
},
|
},
|
||||||
/* hmrOptions: {
|
/* hmrOptions: {
|
||||||
@@ -51,13 +52,16 @@ app.start();
|
|||||||
|
|
||||||
server.use(config.urlPrefix + '/static', express.static(staticFilePath));
|
server.use(config.urlPrefix + '/static', express.static(staticFilePath));
|
||||||
|
|
||||||
const parcelMiddleware = createProxyMiddleware({
|
const proxyCfg = {
|
||||||
target: `http://localhost:${devPort}/`,
|
target: `http://127.0.0.1:${devPort}/`,
|
||||||
pathRewrite: {'^/mhd' : ''} // TODO: Maybe fix this with Parcel.
|
pathRewrite: {},
|
||||||
});
|
};
|
||||||
|
proxyCfg.pathRewrite['^' + config.urlPrefix] = '/'; // TODO: Maybe fix this with Parcel
|
||||||
|
|
||||||
|
const parcelMiddleware = createProxyMiddleware(proxyCfg);
|
||||||
server.use('/', parcelMiddleware);
|
server.use('/', parcelMiddleware);
|
||||||
|
|
||||||
// Run your Express server
|
// Run your Express server
|
||||||
server.listen(servicePort, () => {
|
server.listen(servicePort, '127.0.0.1', () => {
|
||||||
console.log(`Listening to port ${servicePort}...`);
|
console.log(`Listening to port ${servicePort}...`);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user