【发布时间】:2021-06-24 08:36:30
【问题描述】:
我正在尝试使用此快速生成器为 API 服务创建快速服务器:
generator-express-no-stress-typescript
我可以使用 npm run dev 在本地运行 Express 服务器。
我可以运行 npm run compile 在 dist 文件夹中创建生产版本。
dist 文件夹产品包可以使用npm run start 启动,没有问题。
但是,我未能将应用程序部署到我的 Azure 服务器。我已关注this Microsoft document,使用 Visual Studio Code 将 Express.js 部署到 Azure App Service。完成所有步骤后,当我浏览应用程序时,它显示You do not have permission to view this directory or page.
我可以参考任何文章或文件吗?感谢您的帮助。
package.json scripts 部分默认由generator-express-no-stress-typescript创建
"scripts": {
"start": "node dist/index.js",
"compile": "ts-node build.ts && tsc",
"dev": "nodemon server/index.ts | pino-pretty",
"dev:debug": "nodemon --exec \"node -r ts-node/register --inspect-brk\" server/index.ts | pino-pretty",
"lint": "eslint -c .eslintrc.js \"{server, test}/**/*.{js,ts,tsx}\" --quiet",
"lint:fix": "eslint -c .eslintrc.js \"{server, test}/**/*.{js,ts,tsx}\" --quiet --fix",
"test": "mocha -r ts-node/register test/**/*.ts --exit",
"test:debug": "mocha -r ts-node/register --inspect-brk test/**/*.ts --exit"
},
【问题讨论】:
-
Linux 还是 Windows ?
-
我的电脑是 Windows,在 Azure 上我也选择了 Windows。
-
请运行'tsc -v',然后告诉我你使用的是哪个打字稿版本,因为我无法通过在本地运行'npm run start'来成功运行。我可以运行“npm run start:dev”。
-
我的打字稿版本是 4.3.2
-
经过一系列的测试,我失败了。如果有其他相关经验的人可以提供答案,我将开始赏金。
标签: node.js typescript azure express web-deployment