kantega / react-and-spring Goto Github PK
View Code? Open in Web Editor NEWExample of a Spring Boot project with a React frontend
Example of a Spring Boot project with a React frontend
Tried running "mvn clean install" on the cloned project in my windows machine. Node and npm were installed. Execution with goal "npm" and argument "install" fails to execute with the below error.
[INFO] Installed npm locally.
[INFO]
[INFO] --- frontend-maven-plugin:1.6:npm (npm install) @ spring-and-react ---
[INFO] Running 'npm install' in C:\Users\username\Desktop\react-and-spring-master\frontend
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.853 s
[INFO] Finished at: 2019-01-18T00:54:04+05:30
[INFO] Final Memory: 23M/389M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:npm (npm install) on project spring-and-react: Failed to run task: 'npm install' failed. java.io.IOException: Cannot run program "C:\Users\username\Desktop\react-and-spring-master\target\node\node.exe" (in directory "C:\Users\username\Desktop\react-and-spring-master\frontend"): CreateProcess error=193, %1 is not a valid Win32 application -> [Help 1]
Error : When specified, "proxy" in package.json must be a string.
Instead, the type of "proxy" was "object".
Either remove "proxy" from package.json, or make it a string
changing the proxy settings as below worked:
"proxy": "http://localhost:8080/api"
Is it fine to proceed as above?
Spring Boot will take control of the url mapping so anything not specifically defined in a controller will be mapped to the /error path. You need to manually specify the paths used by react-router in a controller and map them all to /index.html.
Here's an example:
@Controller
public class SPAController {
@RequestMapping(value = {"/", "/profile/**"})
public String index() {
return "/index.html";
}
}
Everything works after i finished the steps mentioned in this page.
However I want to add routing to the page and that doesn't work. Anyone has an idea how to solve it?
'mvn' is not recognized as an internal or external command,
operable program or batch file.
when trying to mvn clean install ??
change it to a string format :
"proxy": "http://localhost:3002/api",
This would resolve the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.