mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 02:24:17 +00:00
19 lines
481 B
JavaScript
Executable File
19 lines
481 B
JavaScript
Executable File
class Controller {
|
|
constructor(payload) {
|
|
this.payload = {...payload}
|
|
|
|
return this
|
|
}
|
|
|
|
exec = async (req, res, next) => {
|
|
if (typeof this.payload.exec === "function") {
|
|
try {
|
|
await this.payload.exec (req, res, next)
|
|
} catch (error) {
|
|
return res.status(500).json({ error: error.message, endpoint: this.payload.route })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = { Controller } |