英文:
Is there a way to execute a method of a service using a command with nestjs?
问题
我需要执行一个服务的方法,而不使用 REST API,也就是通过单个执行命令来执行它。
英文:
I need to execute a method of a service without using api rest, that is, execute it through a single execution command
答案1
得分: 1
看起来你想要构建一个命令行界面(CLI)或者只是一个脚本。这在NestJS独立应用程序中是可行的,就像任何Node.js应用程序一样,文档在这里:https://docs.nestjs.com/standalone-applications
你也可以使用第三方包像 nest-commander
,文档在这里:https://docs.nestjs.com/recipes/nest-commander
我建议你深入阅读官方文档。
英文:
looks like you want to build a command line interface (CLI) or just a script. This is feasible with nestjs standalone app like any nodejs app, as the docs shows here: https://docs.nestjs.com/standalone-applications
you can also use a 3rd-party package like nest-commander
, as the docs shows here: https://docs.nestjs.com/recipes/nest-commander
I suggest you to dive into the official docs.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论