从命令行运行NestJS脚本 [英] Run NestJS script from command line

查看:108
本文介绍了从命令行运行NestJS脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够运行一个脚本,该脚本使用NestJS框架来解析XML文件以进行概念验证,但是我不确定该怎么做.

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.

我在/src 内创建了一个 scripts 目录,并将我的 script.ts 和一个初始console.log放置在其中.如何在该文件中运行命令?我应该将script.ts文件更改为纯javascript而不是typescript,然后运行节点myscript.ts吗?这种方式的正确方法是什么?

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?

推荐答案

我设法使用 npx ts-node my-file.ts

这篇关于从命令行运行NestJS脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆