1 |
import DiscordClient from "../client/Client"; |
import DiscordClient from "../client/Client"; |
2 |
import Service from "../utils/structures/Service"; |
import Service from "../utils/structures/Service"; |
3 |
import express, { Express } from 'express'; |
import express, { Express, Router as ExpressRouter } from 'express'; |
4 |
import Router from "./Router"; |
import Router from "./Router"; |
5 |
import path from "path"; |
import path from "path"; |
6 |
|
|
21 |
} |
} |
22 |
|
|
23 |
async boot() { |
async boot() { |
24 |
|
type methods = 'get' | 'post' | 'put' | 'patch' | 'delete'; |
25 |
|
const expressRouter = ExpressRouter(); |
26 |
|
|
27 |
await this.router.loadRoutes(); |
await this.router.loadRoutes(); |
28 |
|
|
29 |
|
for (const route of this.router.routes) { |
30 |
|
expressRouter[route.method.toLowerCase() as methods](route.path, ...route.middlewareList, route.getCallbackFunction()); |
31 |
|
} |
32 |
|
|
33 |
|
this.express.use(expressRouter); |
34 |
} |
} |
35 |
|
|
36 |
async run() { |
async run() { |