-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (29 loc) · 935 Bytes
/
index.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
27
28
29
30
31
32
33
34
35
36
37
38
const express = require("express");
const app = express();
const UserManager = require("./users/UserManager");
var cookieParser = require('cookie-parser')
const fs = require("fs")
const formidable = require('express-formidable');
const RepositoryManager = require("./repository/RepositoryManager");
console.log("Loading users...")
UserManager.loadUsers();
console.log("Loading repositories...")
RepositoryManager.loadRepositories();
console.log("Loading Website...");
app.set('views', './templates');
app.set('view engine', 'pug');
app.use(express.static('files'));
app.use(cookieParser())
app.use(formidable({
encoding: 'utf-8',
multiples: true,
keepExtensions: true
}));
const files = fs.readdirSync("./pages/").filter(file => file.endsWith('.js'));
for(const file of files){
const route = require("./pages/"+file);
app.use("/", route)
}
app.listen(8087, () => {
console.log("Website is loaded !")
})