首页 > 解决方案 > 如何在 Azure 上部署和运行 Passport Express 节点

问题描述

我正在使用护照 oauth2 策略为 SSO 创建快速节点服务。下面是我的 express 节点应用程序代码结构。

AUTH
- certs
    server.cert
    server.key
-index.html
-index.js (creates app as express() https server and validate app.get('/') path using passport)
-package.json (dependecies: body-parser, express, nodemon, passport, passport-oauth2, path)

下面是我的 Package.json

{
   "name": "node-server",
   "version": "1.0.0",
   "description": "node server for passport authentication",
   "main": "index.js",
   "scripts": {
       "server": "node index.js -p 3002"
   },
   "author": "abc",
   "license": "ISC",
   "dependencies": {
        "body-parser": "^1.19.0",
        "express": "^4.17.1",
        "nodemon": "^2.0.6",
        "passport": "^0.4.1",
        "passport-oauth2": "^1.5.0",
        "path": "^0.12.7"
    }
}

现在,如果我运行命令“node index.js”或“npm run server”,它会以“https://localhost:8070”启动我的本地

同样,我想将它部署在 Azure 容器化服务器上​​并想启动服务器。

请帮助我了解如何在 azure 上部署它并启动类似于我的本地主机上方的服务器。

标签: javascriptnode.jsazurepassport.jspassport-local

解决方案


要将 node.js 应用程序部署到 azure,您可以使用 Web 应用程序,点击此链接

https://docs.microsoft.com/en-us/azure/app-service/quickstart-nodejs?pivots=platform-linux#deploy-to-azure

部署完成后,Browse Website在提示中选择以查看新部署的 Web 应用程序。


推荐阅读