loading port from config file

This commit is contained in:
2022-01-30 12:00:23 +02:00
parent c9805693e8
commit 0c507fd33b
4 changed files with 10 additions and 4 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
.idea
node_modules
dist
src/config.json

View File

@@ -4,6 +4,7 @@ import { Socket } from "socket.io";
import { Player } from "./player";
import { PlayerList } from "./playerList";
import { MapTile } from "./mapTile";
import * as config from './config.json';
const app: express.Application = express();
@@ -278,6 +279,6 @@ io.on("connect", (socket: Socket) => {
// });
// });
server.listen(3000, () => {
console.log("listening on *:3000");
server.listen(config.port || 3000, () => {
console.log("listening on *:" + (config.port || 3000));
});

3
src/config.json Normal file
View File

@@ -0,0 +1,3 @@
{
"port": 3000
}

View File

@@ -46,7 +46,8 @@
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"resolveJsonModule": true
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */