loading port from config file
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.vscode
|
.vscode
|
||||||
.idea
|
.idea
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
|
src/config.json
|
||||||
@@ -4,6 +4,7 @@ import { Socket } from "socket.io";
|
|||||||
import { Player } from "./player";
|
import { Player } from "./player";
|
||||||
import { PlayerList } from "./playerList";
|
import { PlayerList } from "./playerList";
|
||||||
import { MapTile } from "./mapTile";
|
import { MapTile } from "./mapTile";
|
||||||
|
import * as config from './config.json';
|
||||||
|
|
||||||
const app: express.Application = express();
|
const app: express.Application = express();
|
||||||
|
|
||||||
@@ -278,6 +279,6 @@ io.on("connect", (socket: Socket) => {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
server.listen(3000, () => {
|
server.listen(config.port || 3000, () => {
|
||||||
console.log("listening on *:3000");
|
console.log("listening on *:" + (config.port || 3000));
|
||||||
});
|
});
|
||||||
|
|||||||
3
src/config.json
Normal file
3
src/config.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"port": 3000
|
||||||
|
}
|
||||||
@@ -46,7 +46,8 @@
|
|||||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
// "types": [], /* Type declaration files to be included in compilation. */
|
// "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. */
|
"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. */
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user