forked from tl-open-source/tl-rtc-file
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
25 lines (19 loc) · 750 Bytes
/
server.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
const express = require("express"); //express
const conf = require("./conf/cfg"); //conf
const fileApiRouters = require("./src/router")(conf); //file routers
let resRouter = conf.router.res;
const fs = require('fs'); // fs
const https = require('https'); // http
let app = express();
console.log("resource including...")
//res
for(let key in resRouter) app.use(key,express.static(resRouter[key]));
//file api
for(let key in fileApiRouters) app.use(key,fileApiRouters[key])
let options = {
key: fs.readFileSync('./conf/keys/server.key'),
cert: fs.readFileSync('./conf/keys/server.crt')
}
https.createServer(options,app).listen(conf.node.port);
console.log("express init...")
console.log("server runing on ",conf.node.port," successful");