You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{RouterContext,Row}from"@deps";import{IPerson}from"../../interfaces/IPerson.ts";importregisterService,{RegisterService}from"../../services/register.ts";constregister: RegisterService=registerService;// THIS WORKS FINEexportclassRegisterController{registerService: RegisterService;constructor(){this.registerService=registerService;// OR new RegisterService(); Doesn't works}publicasyncregisterPerson(ctx: RouterContext<string>,next: ()=>Promise<unknown>): Promise<Row>{next();constbody=awaitctx.request.body({type: 'json'}).value;console.log(this.registerService)// BUT THIS NOTS WORKconstregister=awaitregisterService.create(body);if(!register.isCreated)thrownewError("Error to register person");ctx.response.type="json"ctx.response.status=201;returnctx.response.body=register.person;}}
I've already tried to inject it as a dependency, I've tried to instantiate the class before putting it in the controller, I've tried a lot of things and it didn't work
Windows 11
deno 1.41.1
The text was updated successfully, but these errors were encountered:
Throw this error:
I've already tried to inject it as a dependency, I've tried to instantiate the class before putting it in the controller, I've tried a lot of things and it didn't work
The text was updated successfully, but these errors were encountered: