3

I have just generated an Spring/Angular app using JHipster.

I successfully accessed the home page by using this URL: http://localhost:8080 which redirects to http://localhost:8080/#/ and the index.html file is loaded properly.

I am not sure how Angular and the browser determine that they need to load the index.html file.

Where is this configured in a JHipster app?

edit: Is there some "default home page" configuration somewhere?

balteo
  • 23,602
  • 63
  • 219
  • 412

1 Answers1

4

I successfully accessed the home page by using this URL: http://localhost:8080 which redirects to http://localhost:8080/#/

The request to the server is for "/" and index.html is served. The "/#/" is all client side stuff (Angular routing) that happens when the javascript on the index.html page fires up, not the result of a server side redirect.

Where is this configured in a JHipster app?

This is a Spring Boot default, not something specific to JHipster. From the Spring Boot docs:

The auto-configuration adds the following features on top of Spring’s defaults:

  • Static index.html support.

By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext. It uses the ResourceHttpRequestHandler from Spring MVC so you can modify that behavior by adding your own WebMvcConfigurerAdapter and overriding the addResourceHandlers method.

I don't think this is configurable through a property file or something similar, you'll have to write some code. See the answer to this question.

Community
  • 1
  • 1
John R
  • 2,066
  • 1
  • 11
  • 17