-
Notifications
You must be signed in to change notification settings - Fork 43
/
index.js
73 lines (60 loc) · 1.87 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
FakeLocation-Server
File: index.js
Description: Main code to create the express web server and dispatch the requests.
Author: BobH
Time: 2022-5-11
A free and open source api server for app "Fake Location @ 1.3.0.2"
*/
const ServerVersion = "1.0.0 Alpha";
const express = require('express');
const logger = require('./Logger');
const app = express();
const core = require('./core');
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.get('*', (req, res) => {
res.send("FakeLocationServer @ " + ServerVersion);
});
app.post('/FakeLocation/user/login', (req, res) => {
let reqBody = req.body;
core.login(reqBody, res);
});
app.post('/FakeLocation/user/get', (req, res) => {
let reqBody = req.body;
core.userget(reqBody, res);
});
app.post('/FakeLocation/user/checkPwdExist', (req, res) => {
let reqBody = req.body;
core.checkExist(reqBody, res);
});
app.post('/FakeLocation/user/checkUserExist', (req, res) => {
let reqBody = req.body;
core.checkExist(reqBody, res);
});
app.post('/Notice/getNotices', (req, res) => {
let reqBody = req.body;
core.getNotices(reqBody, res);
});
app.post('/Ads/getAds', (req, res) => {
let reqBody = req.body;
core.getAds(reqBody, res);
});
app.post('/FakeLocation/goods/getRenewalGoodsList', (req, res) => {
let reqBody = req.body;
core.getRenewalGoodsList(reqBody, res);
});
app.post('/FakeLocation/app/getAppConfigs', (req, res) => {
let reqBody = req.body;
core.getAppConfigs(reqBody, res);
});
app.post('/FakeLocation/version/checkApkUpdate', (req, res) => {
let reqBody = req.body;
core.checkApkUpdate(reqBody, res);
});
const server = app.listen(8000, () => {
let host = server.address().address;
let port = server.address().port;
core.Init();
logger.LogInfo("Server running at http://" + host + ":" + port + "!");
});