This commit is contained in:
Matthew Patrick 2021-11-15 17:25:43 +07:00
commit e563f80538
2 changed files with 17 additions and 15 deletions

6
.gitignore vendored
View file

@ -4,9 +4,6 @@ node_modules/
# Package Manager # Package Manager
package-lock.json package-lock.json
# Config
config.js
# IDE Configuration # IDE Configuration
.vscode/ .vscode/
*.code-workspace *.code-workspace
@ -38,3 +35,6 @@ Icon
Network Trash Folder Network Trash Folder
Temporary Items Temporary Items
.apdisk .apdisk
# Config
config.js

View file

@ -2,8 +2,15 @@ var express = require("express");
var cookieParser = require("cookie-parser"); var cookieParser = require("cookie-parser");
var logger = require("morgan"); var logger = require("morgan");
var bodyParser = require("body-parser"); var bodyParser = require("body-parser");
const app = express(); const app = express();
const indexRouter = require('./routes/index');
const api = require('./routes/api');
app.use(express.static("public"));
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(logger("dev")); app.use(logger("dev"));
@ -11,14 +18,9 @@ app.use(express.json());
app.use(express.urlencoded({ extended: false })); app.use(express.urlencoded({ extended: false }));
app.use(cookieParser()); app.use(cookieParser());
const indexRouter = require('./routes/index');
const api = require('./routes/api');
app.use('/', indexRouter); app.use('/', indexRouter);
app.use('/api', api); app.use('/api', api);
app.use("/", indexRouter);
app.use(function (req, res, next) { app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Origin", "*");
res.header( res.header(