简体   繁体   中英

How do I integrate angular 6 and spring MVC with single server?

Angular 6 dist file is imported into the webapp folder.In the dispatcher servlet mapping the url pattern / is working for the REST api calls and the url pattern /** is used for index.html files. What url pattern is to be used for accessing both angular 6 & REST apis.

Thanks

Generally your root path so / should serve the static content and then you have a path like /api/* reserved for rest services. You can do this by putting server.contextPath=/api/* in application.properties or server.servlet.context-path if you are using spring boot 2.0.0. And the you just put all the static content in one of the folders:

  • /META-INF/resources/
  • /resources/
  • /static/
  • /public/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM