-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (36 loc) · 909 Bytes
/
index.js
File metadata and controls
42 lines (36 loc) · 909 Bytes
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
const Koa = require('koa');
const path = require('path');
const views = require('koa-views');
const app = new Koa();
const libs = require('./libs');
const sign = require('./signature');
app.use(views(path.join(__dirname, './views'), {
extension: 'ejs'
}));
app.use(async ctx => {
const startTs = parseInt((new Date().setHours(0,0,0) - 13 * 24 * 60 * 60 * 1000) / 1000);
const endTs = parseInt(new Date() / 1000);
const query = Object.assign({
sdkAppId: '',
startTs,
endTs,
roomNum: '',
userId: '',
// createTime: '',
// destroyTime: '',
// duration: '',
// sendUserId: '',
// receiveUserId: '',
// commId: '',
// userNum: '',
// roomStr: '',
}, ctx.query);
await ctx.render('index', {
sign: sign(),
libs,
query: JSON.stringify(query),
});
});
app.listen(3000, () => {
console.log('server start at poart 3000 ... ...');
});