Closed barenko closed 3 years ago
You can use, this
. It will refer to Fastify instance.
@mandaputtra is right, but you will need to declare a function using the function
keyword in order to have the right context bound to it.
module.exports.GET = async function getWorld(req, res) {
// this = fastify instance
await this.db.connect();
...
}
I have the follow function in the
routes/index.js
file. How can I get the same fastify server instance that the fastify-now was registered?