mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-10-31 19:25:04 +03:00
Main page changed from /index to /
This commit is contained in:
parent
e0d427ac4b
commit
32740a65c4
2 changed files with 10 additions and 24 deletions
34
index.js
34
index.js
|
@ -1,34 +1,20 @@
|
|||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const error = require("./errors/error.js");
|
||||
const session = require('express-session');
|
||||
const error = require("./errors/error.js")
|
||||
|
||||
const bodyParser = require('body-parser');
|
||||
const express = require('express');
|
||||
const fs = require("fs");
|
||||
const app = express();
|
||||
|
||||
app.use(session({ secret: 'secret', resave: true, saveUninitialized: true }));
|
||||
app.use(express.static("public"));
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
app.use(express.static("public"));
|
||||
app.set("view engine", "ejs");
|
||||
app.use(express.json());
|
||||
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set("view engine", "ejs");
|
||||
for (const file of fs.readdirSync("./routes"))
|
||||
app.use("/" + file.slice(0, -3), require(`./routes/${file}`));
|
||||
|
||||
//Temp:
|
||||
app.get("/", (req, res) => res.redirect("/index"));
|
||||
app.all("*", (req, res) => error(res, 404, "We have not got this page."));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (const file of fs.readdirSync("./routes/"))
|
||||
app.use(`/${file.replace(".js", "")}`, require(`./routes/${file}`))
|
||||
|
||||
|
||||
app.all("*", (req, res) => error(res, 404, "We have not got this page."))
|
||||
const port = process.env.PORT || 3000;
|
||||
|
||||
app.listen(port, () => console.log("SERVER ON PORT:", port));
|
||||
|
||||
app.listen(port, () => console.log("Akf-forum on port:", port));
|
Loading…
Reference in a new issue