Services
Use services for messages & working with db
What is service?
Export message to service
import { Service } from 'nestgram';
@Service()
export class AppService {
get helloMessage(): string {
return 'Hello, world!';
}
}import { OnCommand, Controller } from 'nestgram';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService?: AppService) {}
@OnCommand('start')
async start(): Promise<string> {
return this.appService.helloMessage;
}
}Working with db
Last updated