-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (55 loc) · 2.11 KB
/
index.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
55
56
57
58
59
const Koa = require('koa');
const app = new Koa();
const Router = require('koa-router');
const router = new Router({prefix: '/api'});
app.use(router.routes());
router
.get('/index-site', async ctx => {
const indexSite = require('./ss-scripts/index-site');
ctx.body = await indexSite(false);
})
.get('/index-site/update', async ctx => {
const indexSite = require('./ss-scripts/index-site');
ctx.body = await indexSite(true);
})
.get('/index-profi-site', async ctx => {
const indexSite = require('./ss-scripts/index-profi-site');
ctx.body = await indexSite(false);
})
.get('/index-profi-site/update', async ctx => {
const indexSite = require('./ss-scripts/index-profi-site');
ctx.body = await indexSite(true);
})
.get('/position-single/:sheet', async ctx => {
const sheet = ctx.params.sheet;
const positionSingle = require('./ss-scripts/position-single');
ctx.body = await positionSingle(sheet);
})
.get('/position-monitoring/:direction', async ctx => {
const direction = ctx.params.direction;
const positionMonitoring = require('./ss-scripts/position-monitoring');
ctx.body = await positionMonitoring(false, direction);
})
.get('/position-monitoring/update/:direction', async ctx => {
const direction = ctx.params.direction;
const positionMonitoring = require('./ss-scripts/position-monitoring');
ctx.body = await positionMonitoring(true, direction);
})
.get('/uptime-monitoring', async ctx => {
const direction = ctx.params.direction;
const uptimeMonitoring = require('./ss-scripts/uptime-monitoring');
ctx.body = await uptimeMonitoring(false);
})
.get('/uptime-monitoring/profi', async ctx => {
const direction = ctx.params.direction;
const uptimeMonitoring = require('./ss-scripts/uptime-monitoring');
ctx.body = await uptimeMonitoring(true);
})
.get('/search-top/:sheet', async ctx => {
const sheet = ctx.params.sheet;
const searchTop = require('./ss-scripts/search-top');
ctx.body = await searchTop(sheet);
});
const server = app.listen({port: 3002}, () => {
console.log('Server start on port: 3002...');
});