ABC. Net Core API and Angular front-end APP integrated deployment, abpangular
Preface:
Generated on the ABC official website (https://aspnetboilerplate.com. net Core + Angular projects are two independent projects. We can deploy them separately or integrate the frontend and Web APIs. Let's try integration and deployment today.
Frontend Packaging
Make sure that there is no problem with front-end installation and running, how to install and run please refer to blog: http://www.cnblogs.com/donaldtdz/p/7705605.html
Run the ng build command to package. A dist directory is automatically created in the project root directory.
2. Packaging and integration
1. copy the files in the dist directory packaged in step 1 to the wwwroot directory in the background host project (Note: all the static files packaged must be placed in the wwwroot directory, this directory is the root directory of static website resources for subsequent static and dynamic separation and deployment)
2. Create a New View PhotoStory in HomeController. (Note: You can create a View for integration testing. You can create a project based on your needs)
3. copy the code to the PhotoStory view in the index.html file of the distdirectory.
<! Doctype html>
4. Return the default route Index to the view PhotoStory. The integration is complete.
public IActionResult Index(){ //return Redirect("/swagger"); return View("PhotoStory");}
Three Integration run test
Change the URL to http: // localhost: 21021/swagger/the Web API page that will be redirected
If you need to pay attention to cross-origin issues before and after independent deployment, you can view the blog: http://www.cnblogs.com/donaldtdz/p/7882225.html