代码拉取完成,页面将自动刷新
const path = require('path');
const fs = require('fs');
const express = require('express');
const port = process.env.PORT || 2600;
const app = new express();
const bodyParser = require("body-parser");
const multer = require("multer");
const db = require('./supporter/db/connect');
const userroute=require("./supporter/modules/users/users.route");
const chartsroute=require("./supporter/modules/charts/charts.route");
const teamsroute=require("./supporter/modules/teams/teams.route");
const newsroute=require("./supporter/modules/news/news.route");
const shareroute = require('./supporter/modules/share/share.route');
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
// app.use(bodyParser.json());//for parsing application/json
// app.use(bodyParser.urlencoded({ extended: true }));//for parsing application/x-www-form-urlencoded
//配置默认静态路径与页面路由
app.use(express.static('public'));
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, '', 'index.html'));
});
app.get('/login', (req, res) => {
res.sendFile(path.join(__dirname, '', 'login.html'));
});
userroute(app);
chartsroute(app);
teamsroute(app);
newsroute(app);
shareroute(app);
//启动服务器,连接数据库
app.listen(port, (error) => {
if (error) {
console.error(error);
} else {
db.start();
console.info('==> Listening on port %s. Open up http://localhost:%s/ in your browser.', port, port);
}
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。