同一Azure Web App Service上的Vue前端和Express后端 [英] Vue Frontend and Express backend on same Azure web app Service

查看:219
本文介绍了同一Azure Web App Service上的Vue前端和Express后端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个Web应用程序,该应用程序具有Vue前端和Express后端.

I have built a web app that has a Vue front-end and an express back-end.

我试图将它们托管在Azure Web App Service上,但是我是Azure的完全新手. 将客户端放置在一个Web应用程序中,将服务器端放置在另一个Web应用程序中时,Web应用程序运行正常. 我想在同一Web应用程序中同时运行. 从在线研究看来,我需要去:

I am trying to host these on an Azure Web App Service but I am a complete novice with Azure. I have gotten the web app working fine when I place the Client side in one web app and the Server side in a different one. I want to have both running in the same web app. From researching online it seems that I need to go to:

my web app-> configuration-> path mappings ->Virtual applications and directories.

我使用虚拟路径"/app"创建了一个新应用程序.和物理路径"site \ app". 我将后端(使用Visual Studio代码)部署到了我的azure Web应用程序,因此它位于wwwroot中. 在filezilla中,我在站点目录中创建一个名为"app"的新文件夹.并粘贴到我构建的Vue客户端中. 但是,当我尝试导航到 www.myapp.azurewebsites.net/app 时,我不是显示了预期的Vue index.html而不是404.如果我只是导航到 www.myapp.azurewebsites.net/我按预期从服务器端获得了默认路由.

I created a new application with Virtual Path "/app" and physical path "site\app". I deployed (using visual studio code) my back-end to my azure web app and thus this sits inside wwwroot. In filezilla I create a new folder in the site directory called "app" and paste in my built Vue client side. However, when I try to navigate to www.myapp.azurewebsites.net/app I am not presented with the expected Vue index.html rather a 404. If I just navigate to www.myapp.azurewebsites.net/ I get the default route from the server side as expected.

我在做什么错了?

推荐答案

创建Web应用程序时,请选择Windows操作环境,因为当前选择的Linux 不支持虚拟应用程序和目录

When creating a webapp, please choose Windows operating environment, because currently choosing Linux does not support Virtual Application and directories.

目录结构应如下所示.

在门户网站中设置.

有关更多详细信息,您可以在另一篇文章中参考我的答案.

For more details, you can refer my answer in another post.

这篇关于同一Azure Web App Service上的Vue前端和Express后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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