mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
fix function transformation
This commit is contained in:
parent
344179e5c6
commit
e37684760a
@ -0,0 +1,9 @@
|
|||||||
|
export default {
|
||||||
|
method: "get",
|
||||||
|
route: "/withoutClass",
|
||||||
|
fn: async (req, res) => {
|
||||||
|
return res.json({
|
||||||
|
message: "Im an object endpoint",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -60,10 +60,8 @@ module.exports = class Controller {
|
|||||||
this.customHandler = objEndpoint.customHandler
|
this.customHandler = objEndpoint.customHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (typeof endpoint === "function") {
|
||||||
|
// Handle endpoint transformation as a function
|
||||||
// Handle endpoint transformation as a function
|
|
||||||
if (typeof endpoint === "function") {
|
|
||||||
const endpointFn = endpoint
|
const endpointFn = endpoint
|
||||||
|
|
||||||
endpoint = class extends Endpoint {
|
endpoint = class extends Endpoint {
|
||||||
@ -122,6 +120,8 @@ module.exports = class Controller {
|
|||||||
|
|
||||||
return (...args) => new Promise(async (resolve, reject) => {
|
return (...args) => new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
|
console.log(fn)
|
||||||
|
|
||||||
const result = await fn(...args)
|
const result = await fn(...args)
|
||||||
|
|
||||||
return resolve(result)
|
return resolve(result)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user