[英]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. 将Angular 6 dist文件导入到webapp文件夹中。在调度程序servlet映射中,URL模式/用于REST api调用,URL模式/ **用于index.html文件。 What url pattern is to be used for accessing both angular 6 & REST apis.
什么URL模式将用于访问Angular 6和REST API。
Thanks 谢谢
Generally your root path so /
should serve the static content and then you have a path like /api/*
reserved for rest services. 通常,您的根路径so
/
应该为静态内容提供服务,然后您会保留/api/*
类的路径供其余服务使用。 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. 如果您使用的是Spring Boot 2.0.0,则可以通过将
server.contextPath=/api/*
放在application.properties
或server.servlet.context-path
中来实现。 And the you just put all the static content in one of the folders: 然后,您只需将所有静态内容放入其中一个文件夹中:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.