部署React或Angular或Ember应用程序时如何设置Web应用程序的起始页面或控制器方法 [英] How to set starting page or controller method of a web application when we are deploying the React or Angular or Ember applications

查看:85
本文介绍了部署React或Angular或Ember应用程序时如何设置Web应用程序的起始页面或控制器方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了一个React应用程序,该应用程序调用了Web Api,该应用程序在npm start下运行良好,并且一切正常,但是当我部署该应用程序时,应该如何设置该应用程序的起始页是React的新手,我从未参与过部署任何SPA应用程序的工作吗?要在我的网站文件夹中的服务器上进行部署时,如何设置我的react应用程序的启动?我可以改变吗?我该如何更改?

I have completed a React Application, which calls a Web Api, the application runs fine with npm start, its all working fine, but when I am deploying the application, how should I set up the start page of the application, I am new to React and I have never been part of the deploying any SPA application? How can I set the start of my react application when I am going to deploy on the Server in my Website folder? Can I change it? How can I change it?

当Web API与React应用分开部署时,新请求将首先到达何处,无论是去React SPA还是去Web API控制器方法.

When Web API is deployed separately from the React app, where would the new request first goes, whether it would go to the React SPA or it goes to the Web APIs controller method.

我对Vue.js,Angular和Ember有相同的问题,起始页面是什么,如何设置它们,以及我们是否为js和Web Api服务器端逻辑运行了单独的Web应用程序-请求首先在哪里进行当我们只输入例如xxxx.com时,第一页是什么.

Same questions I have for Vue.js, Angular and Ember, what are the starting pages, how to set them and if we have separate web applications running for the js and Web Api server side logic - where do the request first go when we just type for example: xxxx.com, what's the first page.

我遇到了这个问题,因为当我使用npm build构建Ember项目时-它没有创建default.htm或index.html文件-那么如何转到第一页?有助于理解此处的流程.我知道它最愚蠢的问题,但想理解-谢谢.

I got this question since when I build my Ember project using npm build - its not creating the default.htm or index.html files - so how is it going to the first page? Any help to understand the flow here. I know its dumbest question but want to understand - thank you.

推荐答案

要创建一个简单的react应用,您可以按照以下步骤操作:

To create a simple react app you could follow the below steps:

1)以管理员身份运行命令提示符.

1)Run command prompt as administrator.

2)运行以下命令以创建应用:

2)run below command to create an app:

npm init react-app my-app

3)使用以下命令进入应用文件夹:

3)enter to the app folder by using:

cd my-app

4)下面的命令运行该应用程序:

4)below command to run the application:

npm start

5)使用以下命令构建应用:

5)build an app using below command:

npm run build

在您的应用程序下创建一个构建文件夹.

which create a build folder under your application.

当您在iis中创建站点时,将该文件夹用作站点或应用程序路径.

when you create a site in iis then use that folder as a site or application path.

注意:不要忘记为站点文件夹分配iis_iusrs和iusr权限.

Note: do not forget to assign the iis_iusrs and iusr permission to the site folder.

这篇关于部署React或Angular或Ember应用程序时如何设置Web应用程序的起始页面或控制器方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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