I can't use services like nest js
bobwatcherx opened this issue · 2 comments
bobwatcherx commented
I want to use the service like in nest js
but apparently not working
is there something wrong with me
cats.controller.ts
import {
Controller,
Injectable,
Get } from 'https://deno.land/x/danet/mod.ts';
import {Childservice} from './service/my.service.ts';
@Controller('cats')
export class CatsController {
constructor(private childservice:Childservice){}
@Get()
findAll(): string {
return this.childservice.Gethello()
}
}
my.service.ts
import {
Controller,
Injectable,
SCOPE,
Get } from 'https://deno.land/x/danet/mod.ts';
@Injectable({ scope: SCOPE.REQUEST })
export class Childservice{
Gethello(){
return "ini service"
}
}
error message in browser :
{"status":500,"message":"Cannot read properties of undefined (reading 'Gethello')"}
bobwatcherx commented
and canot use useGuard
error message:
error: Uncaught SyntaxError: The requested module 'https://deno.land/x/danet/mod.ts' does not provide an export named 'UseGuards'
Sorikairox commented
About the service :
Can you show us your module?
About the UseGuards
, I think you meant to use UseGuard
with Guard as singular ? UseGuards
does not exist