Search code examples
typescriptcommandnestjs

Run NestJS script from command line


I want to be able to run a script that parses an XML file using NestJS framework for a proof-of-concept, but I'm not sure how to do it.

I created a scripts directory inside /src and placed my script.ts with an initial console.log there. How can I run commands within that file? Should I change the script.ts file to plain javascript instead of typescript and then run node myscript.ts? What is the correct approach for this manner?


Solution

  • I managed to run my ts file using npx ts-node my-file.ts