问题
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?
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.
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.
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.
回答1:
To create a simple react app you could follow the below steps:
1)Run command prompt as administrator.
2)run below command to create an app:
npm init react-app my-app
3)enter to the app folder by using:
cd my-app
4)below command to run the application:
npm start
5)build an app using below command:
npm run build
which create a build folder under your application.
when you create a site in iis then use that folder as a site or application path.
Note: do not forget to assign the iis_iusrs and iusr permission to the site folder.
来源:https://stackoverflow.com/questions/60105964/how-to-set-starting-page-or-controller-method-of-a-web-application-when-we-are-d