mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
support load controllers
This commit is contained in:
parent
d4586801cd
commit
d80f7a3736
@ -44,6 +44,7 @@ class Server {
|
||||
this.routes = []
|
||||
this.endpoints = {}
|
||||
this.middlewares = []
|
||||
this.controllers = { ...this.params.controllers }
|
||||
this.headers = { ...defaultHeaders, ...this.params.headers }
|
||||
|
||||
//* set server basics
|
||||
@ -174,7 +175,12 @@ class Server {
|
||||
|
||||
// check if controller is an already a controller
|
||||
if (typeof controller === "string") {
|
||||
controller = fetchController(controller)
|
||||
// check if the controller is already loaded, else try to fetch
|
||||
if (typeof this.controllers[controller] !== "undefined") {
|
||||
controller = this.controllers[controller]
|
||||
} else {
|
||||
controller = fetchController(controller)
|
||||
}
|
||||
}
|
||||
|
||||
// check if the controller is an default function and transform it into an controller
|
||||
|
Loading…
x
Reference in New Issue
Block a user