-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.js
29 lines (26 loc) · 1.07 KB
/
run.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"use strict";
let isDebug = process.env.NODE_ENV !== 'production';
const path = require("path");
const http = require("http");
const Cfg = require('./utiles/Cfg');
const config = require('./utiles/config');
const router = require('./router');
const redis = require('./utiles/redis');
const configPath = 'config/';
const initConfig = async () => {
// get
config.LoadGlobalConfig();
console.log(`${isDebug ? 'DEVELOPMENT' : 'PRODUCTION'} MODE, loading config ....`);
await config.LoadGeneRegConfig(path.join(__dirname, configPath + "GeneRegConfig.json")); //加载基因配置
await config.LoadGeneCfg(path.join(__dirname, configPath + "GeneConfig.json")); //加载基因配置
await config.LoadGeneColorConfig(path.join(__dirname, configPath + "GeneColorConfig.json")); //加载基因配置
};
let createServer = () => {
http.createServer(router.onRequest).listen(Cfg.serverPort);
console.log(`Server Started. Please visit http://127.0.0.1:${Cfg.serverPort}/index.html`);
};
const run = async () => {
redis.redisConnect(createServer);
};
initConfig();
run();