Writing CLI tools for Vendure #1050
-
How do I go about writing CLI tools for Vendure. The bootstrap method starts a server, but I need some container that will load the Vendure config and allow me to import and run custom code (e.g. run a query against the DB from the command line) ? Is there docs on this topic? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
(copying reply from Slack) When you call const app = await bootstrap(config);
const connection = app.get(TransactionalConnection); More can be found in the Nest docs: https://docs.nestjs.com/standalone-applications#standalone-applications |
Beta Was this translation helpful? Give feedback.
(copying reply from Slack)
When you call
bootstrap(config)
it returns an instance of the Nest application, which you can use to get any provider from the app and use directly in your CLI program, e.g.:More can be found in the Nest docs: https://docs.nestjs.com/standalone-applications#standalone-applications