mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 02:24: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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle endpoint transformation as a function
|
||||
if (typeof endpoint === "function") {
|
||||
} else if (typeof endpoint === "function") {
|
||||
// Handle endpoint transformation as a function
|
||||
const endpointFn = endpoint
|
||||
|
||||
endpoint = class extends Endpoint {
|
||||
@ -122,6 +120,8 @@ module.exports = class Controller {
|
||||
|
||||
return (...args) => new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
console.log(fn)
|
||||
|
||||
const result = await fn(...args)
|
||||
|
||||
return resolve(result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user