我正在尝试部署Nestjs API(使用Auth0身份验证)。当我使用npm run start:watch server
在VS代码中运行它时,一切都很好。
现在的问题是:我应该怎么做才能在网络服务器上部署它?我应该只复制dist文件夹(在runnin tsc
之后)吗?那node_modules呢?我应该把港口留到3000吗?
作为旁注,我试图在Azure上部署它,但我想这些问题适用于任何平台。
非常感谢!
答案 0 :(得分:3)
Modify your package.json file, and add a postinstall
script, this script should be tsc
or tsc --sourceMap false
if you would like to avoid sourceMaps from being generated.
That would make azure to run tsc after installing all npm packages, remember to change start
script also, so its value is 'node dist/index.js'