How to use Spring MVC with node.js
Asked Answered
B

2

7

I would like to know if it is possible to use Spring MVC (using Gradle) for backend stuff together with node.js as the web server,and how? Do they communicate via JSON?

The reason I would like to use node.js is that I want to use some modules such as Yeoman (to use the angular-generator), grunt, bower, socket.io etc. and Angularjs (for routing, controllers etc.)

I would also like to use a sql database (mysql or sqlite) instead of a nosql database such as mongodb.

How is this achieved? Do I just add node.js for the frontend stuff to my Spring project? Are there any tutorials I can follow or repositories I can check out?

Edit

I have checked out JHipster but its not exactly what Im looking for. Is there a simpler approach where you just combine the two and use gradle instead of maven? I felt like JHipster was just a bit too much.

Beggs answered 29/4, 2014 at 11:40 Comment(0)
P
6

Although it's not exactly what you are asking for, check out JHipster. It's a yeoman generator that bootstraps a Spring backend project with AngularJS in the frontend (along with power of Bower and Grunt)

I posted this because JHipster it seems to meet most of your requirements and is probably a lot easier to use than some ad-hoc integration of Spring and Node.js

Pack answered 29/4, 2014 at 11:49 Comment(5)
Okay, It is very super close to what I want. I noticed its using maven on the server side instead og gradle wich is what Im most familiar with. Is it a simple way to change it around and use gradle instead? I also noticed the prodDB is mysql I think, and thats good for me because that is also what Im most familiar with.Beggs
I can't really point you to any tutorials that migrate from Gradle to Maven (since the opposite usually happens :)). However the dependency management is exactly the same and if you don't want any custom tasks, any weird plugins or a non standard project structure, it should be no problem at all to use Maven. Also IDE support is much better for Maven and there are is a lot of information on the webPack
well.. maven to gradle. But If I can find out how to migrate to gradle from maven I think this project is what I'm looking for. Looks simple and clean :)Beggs
No problem! I suggest you give it a try despite being Maven, you probably won't have much trouble adapting to it.Pack
@Rockyy If you check out JHIpister's latest version, you see that it can generate Maven as well as Gradle build filesPack
J
2

Here is a spring article from a while ago of using spring, mongo, and nodejs in a project together.

Additionally, spring has 2 guides for accessing relational data such as mysql: relational-data-access and accessing-data-jpa

Juniejunieta answered 29/4, 2014 at 12:6 Comment(1)
..wow. How could I not see them in on the guides page? haha thank you!Beggs

© 2022 - 2024 — McMap. All rights reserved.