Commit 94674652 by lixinming

no message

parent 9b048e83
...@@ -30,8 +30,6 @@ export class httpServer { ...@@ -30,8 +30,6 @@ export class httpServer {
// httpServer.use(bodyParser.json({limit:'5mb'})); // httpServer.use(bodyParser.json({limit:'5mb'}));
// httpServer.use(bodyParser.urlencoded({limit:'5mb', extends:true})); // httpServer.use(bodyParser.urlencoded({limit:'5mb', extends:true}));
httpServer.use(express.static("./static") );
httpServer.use(express.static("./files") );
const root = path.join(__dirname, "../../public"); const root = path.join(__dirname, "../../public");
httpServer.use(express.static(root)); httpServer.use(express.static(root));
httpServer.use(fallback('index.html', { root })); httpServer.use(fallback('index.html', { root }));
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import { get, post, postForm } from '../util/request'; import { get, post, postForm } from '../util/request';
var formidable = require("formidable");
const ApiConfig = { const ApiConfig = {
token:{type:"post", url:'/oauth/token', name:"获取token"}, token:{type:"post", url:'/oauth/token', name:"获取token"},
...@@ -32,33 +31,25 @@ export function setDianXinRouter(httpServer) { ...@@ -32,33 +31,25 @@ export function setDianXinRouter(httpServer) {
for (let key in ApiConfig) { for (let key in ApiConfig) {
let {url, name, type} = ApiConfig[key]; let {url, name, type} = ApiConfig[key];
if (type == "post") {
httpServer.post(url, asyncHandler( async (req, res) => { httpServer.post(url, asyncHandler( async (req, res) => {
const UrlStr = `http://61.171.4.98:9090${url}`; const UrlStr = `http://61.171.4.98:9090${url}`;
let result; let result;
if (key == "token") {
let param = req.body; let param = req.body;
if (type == "post") {
if (key == "token") {
result = await postForm(UrlStr, param, {}); result = await postForm(UrlStr, param, {});
} else { } else {
let param = req.body;
result = await post(UrlStr, param, {}); result = await post(UrlStr, param, {});
} }
} else {
result = await get(UrlStr, param, {});
}
res.packageRes(result); res.packageRes(result);
} )); } ));
}
else {
httpServer.get(url, asyncHandler( t));
}
}
}
async function t(req, res) { }
let url = '/service/api/nmzx/teacher_info_get';
const UrlStr = `http://61.171.4.98:9090${url}`;
let param = req.query;
let result = await get(UrlStr, param, {});
res.packageRes(result);
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment