Handler fixed for api

This commit is contained in:
Akif Yüce 2022-03-22 07:46:18 +03:00 committed by GitHub
parent 0dd3ab8838
commit 9e01765228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,8 +13,8 @@ app.set("view engine", "ejs");
app.use(express.json()); app.use(express.json());
for (const file of fs.readdirSync("./routes")) for (const file of fs.readdirSync("./routes"))
app.use("/" + file.slice(0, -3), require(`./routes/${file}`)); app.use("/" + file.replace(".js", ""), require(`./routes/${file}`));
app.all("*", (req, res) => error(res, 404, "We have not got this page.")); app.all("*", (req, res) => error(res, 404, "We have not got this page."));
app.listen(port, () => console.log("Akf-forum on port:", port)); app.listen(port, () => console.log("Akf-forum on port:", port));