SpringBoot serving React
* build React release bundle npm run build * copy build directory to backend/src/main/resources/static * enjoy husle free deployment
This commit is contained in:
		
							parent
							
								
									dc3fd61bd3
								
							
						
					
					
						commit
						2a3248435c
					
				@ -0,0 +1,20 @@
 | 
			
		||||
package djmil.cordacheckers;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PutMapping;
 | 
			
		||||
 | 
			
		||||
import jakarta.servlet.http.HttpServletRequest;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class ReactAppController {
 | 
			
		||||
    // This controller simply redirects all UI related routes
 | 
			
		||||
    // to index.html, allowing react and react-router to work its magic
 | 
			
		||||
 | 
			
		||||
    @GetMapping(value = { "/", "/games/*","/about","/leaderboard"  })
 | 
			
		||||
    @PutMapping("/error")
 | 
			
		||||
    public String getIndex(HttpServletRequest inRequest) {
 | 
			
		||||
        return "/index.html";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -8,4 +8,6 @@ corda.root.login=admin
 | 
			
		||||
corda.root.passw=admin
 | 
			
		||||
corda.client.maxPollAttempts=30
 | 
			
		||||
 | 
			
		||||
server.port=8081
 | 
			
		||||
server.port=8081
 | 
			
		||||
 | 
			
		||||
#logging.level.org.springframework.web=DEBUG
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user