-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsite.js
26 lines (24 loc) · 779 Bytes
/
site.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module.exports = () => {
const express = require("express");
const app = express();
const path = require("path");
const hbs = require("hbs");
const { readdirSync } = require("fs");
app.use(express.static(path.join(__dirname, "views")));
app.set("view engine", "hbs");
app.get("/", (req, res) => {
let command = {};
readdirSync("./commands")
.filter(folders => folders !== "Owner")
.map(folders => {
command[folders] = {};
readdirSync(`./commands/${folders}`).map(files => {
command[folders][
files.replace(".js", "")
] = require(`./commands/${folders}/${files}`);
});
});
res.render("index", { data: { command } });
});
app.listen(3000, console.log("site is ready"));
};