TypeScript Java HTML JavaScript CSS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.mvn/wrapper Bump maven wrapper Mar 12, 2018
front ng-http-loader 2.3.0 Jun 15, 2018
src Return void, not String May 20, 2018
.gitignore Add logback config May 18, 2017
.travis.yml Remove node 6.x support May 11, 2018
LICENSE Update LICENCE May 24, 2018
README.md README May 11, 2018
mvnw Bump maven wrapper Mar 12, 2018
mvnw.cmd Bump maven wrapper Mar 12, 2018
pom.xml Spring Boot 2.0.3 Jun 16, 2018

README.md

Build Status

NB: Older Spring Boot and Angular versions are available in branches.

Spring Boot 2.x and Angular 6.x with HTML 5 router

This project provides an example of an Angular single page application, served by Tomcat, configured with the html5 router.

The SinglePageAppConfig makes the magic here.

The base-href in configured by the ResourceResolver. It takes the value of the application context-path at runtime when served by tomcat.

It's useful if you want to serve an Angular application with the html5 router, and avoid the dashed URL.

This html5 router mode makes pretty URL, but has a default : Refreshing pages (or accessing them directly) will give you a 404 http error if no RewriteRule is provided by the http server that serve the application.

Handling the base-href dynamically can be tricky too. Here it's done once and for all by the ResourceResolver.

This project includes too a custom http interceptor. It's useful to show a loader during long http requests for example.

To test the fully built project, run SpringBootAngularHTML5Application after an ./mvnw clean install -Pfront, and point your browser to http://localhost:10000/my-context/path.

If you want to play with the front part, go to the front folder and run yarn start or npm start. Http requests will be correctly proxyfied to your backend.

The front-end part has been scaffolded with angular-cli.