Some Update

This commit is contained in:
2024-09-14 13:52:28 -04:00
parent b07d5bbdfc
commit 7c4ce19e6e
3 changed files with 8 additions and 80 deletions

View File

@@ -17,6 +17,8 @@ const MongoServer = new Mongo(process.env.MONGO_URI);
app.use(cors());
app.set("mongo", MongoServer);
let routePaths = [];
async function loadFolder(filePath) {
let files = [];
fs.readdirSync(filePath).forEach(file => {
@@ -34,6 +36,7 @@ async function loadFiles(filePath) {
if (file.default) {
let route = new file.default();
app.use(route.path, route.getRouter());
routePaths.push(route.path);
console.log(`Loaded ${route.path}`);
}
}
@@ -58,6 +61,7 @@ try {
}, ms('1s'));
}
server.listen(process.env.PORT, () => {
console.log(`listening on port http://localhost:${process.env.PORT}`);
});