forked from LightAnimate-The-Vyonders/Wrapper-Online-3.1.1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
54 lines (51 loc) · 1.28 KB
/
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const env = Object.assign(process.env,
require('./env'),
require('./config'));
const http = require('http');
const pmc = require('./character/premade');
const chl = require('./character/load');
const chs = require('./character/save');
const asu = require('./asset/upload');
const stl = require('./static/load');
const stp = require('./static/page');
const asl = require('./asset/load');
const asL = require('./asset/list');
const ast = require('./asset/thmb');
const mvl = require('./movie/load');
const mvL = require('./movie/list');
const mvm = require('./movie/meta');
const mvs = require('./movie/save');
const mvt = require('./movie/thmb');
const thL = require('./theme/list');
const thl = require('./theme/load');
const tsv = require('./tts/voices');
const tsl = require('./tts/load');
const evt = require('./events');
const url = require('url');
const functions = [
mvL,
pmc,
asl,
evt,
chl,
thl,
thL,
chs,
asL,
tsl,
ast,
mvm,
mvl,
mvs,
mvt,
tsv,
asu,
stp,
stl,
];
module.exports = http.createServer((req, res) => {
const parsedUrl = url.parse(req.url, true);
//if (!parsedUrl.path.endsWith('/')) parsedUrl.path += '/';
const found = functions.find(f => f(req, res, parsedUrl));
if (!found) { res.statusCode = 404; res.end(); }
}).listen(env.PORT || env.SERVER_PORT, console.log);