【发布时间】:2021-05-13 23:07:27
【问题描述】:
我有一个节点 js 网站,我正在使用 Visual Studio 代码将其部署到 azure 服务器。以下是我在 server.js 的代码
var express =require('express');
var bodyParser=require("body-parser")
var app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
var nodemailer = require("nodemailer");
var port=process.env.PORT || 3000;
app.use(express.static(__dirname + '/public'));
app.get('/',function(req,res){
console.log('hello from server');
res.render('./public/index.html');
});
我将网站部署到 azure 应用服务,并且 url 总是希望将 index.html 添加到它的工作。例如 https://abc.azurewebsites.net 不起作用,但 https://abc.azurewebsites.net/index.html 起作用。如何从 url 中删除 index.html?
我的 azure 文件夹结构是 site/wwwroot/public/all html files。
谁能提出解决方案
【问题讨论】:
-
基于window os还是linux os?
-
基于windows操作系统
标签: node.js azure visual-studio-code