I read the docs from here : https://docs.adonisjs.com/guides/database/debugging#pretty-print-queries
And I try like this :
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
import Database from '@ioc:Adonis/Lucid/Database'
import Event from '@ioc:Adonis/Core/Event'
export default class UsersController {
public async index({ params, response }: HttpContextContract) {
const results = await Database
.query()
.select('*')
.from('users as a')
.innerJoin('posts as b', 'a.id', 'b.user_id')
.groupBy('a.id')
Event.on('db:query', Database.prettyPrint)
return response.status(200).json({ code: 200, status: 'success', data: results })
}
}
I try using the pretty print queries like that and I call the query. Then I check on the terminal and postman too. But I don't find the result
Where do I check the debugging results of adonis api query?
Please help. Thanks