Closed moha-fl-dev closed 2 months ago
The services cannot inject the HTTP context directly into the constructor because the context is changed on each new HTTP request.
You could pass the request to a method on the service like this:
const { make, http } = context
const service = await make('hello-service')
await service.handleRequest(http)
This would require that your service had a method async handleRequest(context: HttpContext) {}
`@inject() export default class WelcomeService { constructor(protected ctx: HttpContext) {} // breaks the app and produces: help: 'Container is not able to resolve "WelcomeService" class dependencies. Did you mean to use @inject decorator'
getMessage() { return '...powered by AdonisJS 😎' } }`