代码拉取完成,页面将自动刷新
同步操作将从 Arc/全自动学习 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const createError = require('http-errors');
const express = require('express');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const path = require('path')
const handleProxy = require('./handleProxy')
function createApp(port) {
const app = express();
app.set('views', path.join(__dirname, './../views'));
app.set('view engine', 'pug');
// app.use(expressLogger)
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(bodyParser.urlencoded({ limit: '100mb', extended: false }), bodyParser.json({ limit: '100mb' }));
app.use(express.static(path.join(__dirname, './public')));
app.use(require('./routes/login')) // 登录
app.use(require('./routes/learn')) // 学习
handleProxy(app, port)
/** 核心业务:反代逻辑 */
app.use(function (req, res, next) {
next(createError(404));
});
app.disabled('etag'); // turn off
app.use(function (err, req, res, next) {
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
res.status(err.status || 500);
res.json(err);
});
app.listen(port, () => {
console.log(`App is now running at ${port}`)
})
return app;
}
createApp(4000)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。