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