I have faced a problem connected with project config. I am working on an application which consist of server-side (Spring Boot App) and client-side(Angular-Gulp). I would like to configure my project so that when I build a jar file it would include both client and server side. What should I start with? I am using maven. Is it even possible? (if you need some of my code to answer this question just let me know).
Thanks in advance for your answer.
I would recommend you to checkout the article in this location. I too found it difficult when it was not in the standard documentation for the spring boot folder structure.
https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
If you place the final artifacts form your gulp build to be in one of the folders that spring boot recognizes as web folder will do the trick.
I tried to do the same with Angular2 and Spring Boot and it did work. Please see the my project https://github.com/reflexdemon/shop and let me know your feedback.
Related
I know there are many articles on google about this but in some cases they are keeping react(frontend) + springboot(backend) together in a single war, but my requirement is different I want to keep the both wars as separate.
So what I tried till now,
Directly adding the react build folder in jboss->standalone->deployment but it does not work, it works on tomcat but not on jboss
Then I created a new dynamic web maven project and renamed react build folder and added it to maven project webapps directory and created a war, but after deployment its giving 403 error, and I am not getting why.
Here is a snapshot of my folder structure, pom file and error on browser
Please help regarding this have been stuck at it for days now with jboss
Is there any other way to do it, I will be happy to change my approach.
tried this also, did not worked
https://www.megadix.it/blog/create-react-app-servlet/
spring boot comes with default tomcat, you can exclude from the dependency
https://spring.io/blog/2014/03/07/deploying-spring-boot-applications
https://dev.to/jakmar17/deploy-spring-boot-on-wildfly-application-server-2029
I have the same problem and I haven't found a good solution. The best I found is to create a dynamic web project in eclipse. Copy the build files into webContent and use HashRouter instead of BrowserRouter with basename equal to the project name. Finally compile and generate the war. I hope the advice helps you.
I am building one application with Laravel as back-end and React.js as front-end. How to host the application in BigRock or GoDaddy? I searched for 2 days, and found nothing related. Please HELP!!
Laravel application hosting don't need something special... just take care of these things.
php version as per the desired laravel version.
composer should be installed on server.
Some pre-dependancies check here... https://laravel.com/docs/5.8/installation
Your domain should point to <application_root>/public folder.
If you are using mix make sure node should be installed.
After that..
Just clone / upload the code on server and run the desired commands like..
composer install & npm install to install the laravel dependancies & node dependancies.
As per your case you are going to host two application here. So you can follow the following approach.
Host laravel application as sub-domain like api.domain.com and react application on main domain.
I hope you are already fimilar with what's required for hosting react application.
Edited:
For the shared hosting, you can request to enabled the shell access from hosting provider support team. Once they enabled, you'll able to run the linux command and do install by yourself.
Sometimes they could install required software for you.
All the best!
I'm having an application built with AngularJS (not Angular 2) and is ready to get deployed. In Angular 2+, we'll be building the project and the output of that build command will be a set of html, js, css files with assets folder. I can keep them in my webroot(htdocs in case of Apache server) and run the application. But how to do the same in AngularJS app?
Please note that I don't want to use npm start which actually runs on a port. I've an Apache server and I wanted to place my code in that folder (say htdocs/myAngularJSApp) and I want to access it using www.mydomain.com/myAngularJSApp.
Please help. Thanks in Advance.
Actually, no need to build. Just host it and it will work.
I am trying to figure out how to separate the frontend from the backend. Example----
DemoProject------
-----------`backend` (module)
-------`frontend` (module)
src
pom.xml
Frontend will be Angular and the backend will be Spring-boot. I am trying to find a sample project or hopefully someone can point me in the right direction. I do not want to make a monolithic application, more micro service type application.
One approcach would be to generate an EAR and deploy it to any enterprise application server.
If you are using maven, then you can have achieve this using a multi-module project.
For this approach you can have 3 child modules and 1 parent module.
You can put the front end code in one module and let the pom.xml generate a WAR out of it.
The second module will have all your back-end code and its pom will generate a JAR (or a WAR is also fine).
The third module will do nothing apart from simply packing the JAR and the WAR into an EAR.
These three modules will be the child modules.
The parent module is just the aggregator module which will execute the pom for each of its child modules. This way, you will you will end up having a JAR, WAR and an EAR.
The EAR is the one that you will deploy to your server.
This sample application and the presentation that goes with it describe a way to organize your Spring Boot application with a frontend/backend module while still leveraging the devtools features.
Currently trying to implement angular js with spring mvc
Tried to implement the sample project springmvc-angularjs-master from the site-https://github.com/xvitcoder/spring-mvc-angularjs , not sure how to use the folder structure of this sample project into a spring project.
i read the thread - Spring MVC and Angularjs
but still could not find the solution. Do i need to create new folder webapp under the src folder in the web application?
can someone help me how to convert this sample project into spring web application?
i am not using maven and using simple web application with spring capabilites in myeclipse ide.
Current project folder structure:
SampleApp
-src
--controller,bean folders
-webroot
--webinf
---web.xml,springmvc.xml
---html folder(index.html,etc.,)
--resources
---js
----app.js,services.js,controller.js and lib folder
You should be able to import the project as Maven project (Import > Maven > Existing MavenProject) and run it as is. All of the necessary mappings can be found in /src/main/webapp/WEB-INF/spring/webapp-config.xml
Once you have your head wrapped around that, you should be able to extract what you need.
I also noticed some of the #override annotations were throwing some errors. I just removed them.