jnfr
jnfr

Reputation: 931

Trying to figure out how to tie it all together with Node.js, Java and HTML5

I'm trying to figure out a good/functional stack to use. I am competent in Java and HTML5 and have recently started learning Node.js. I'm interested in making a web application that makes API calls, gets the data, runs it through some algorithms and display on the front end.

I was thinking of using Java, Node.js and HTML5 for the frontend. I'm confused how to tie it all together. Should I make the API calls from Node.js and send the data to my Java backend through ports, manipulate the data, then send it to the front-end? I'm having a hard time seeing everything come together.

Any input helps! Thanks!

Upvotes: 3

Views: 334

Answers (2)

clagccs
clagccs

Reputation: 2324

you could use zeromq which has nodejs and java bindings (use jzmq) it 's a message queue very simple of use and with an amazing performance, if you haven't experience with message queues it's probably the best choice

the book nodejs the right way has a nice introduction to zeromq, mathias nehlsen has a post using scala (using the zeromq java library) http://matthiasnehlsen.com/blog/2013/06/02/scaling-play-applications-with-zeromq/

Is a good approach use nodejs for the webserver and communicate with java for high intensive code or analytic, nodejs is pretty fast for async operations but is not well suitable (at least not so good as java) for high intensive computation or parallel processing...

unfortunately the java resources for learning zeromq are scarce but the api is simple and similar between all language bindings.

Upvotes: 0

mamoo
mamoo

Reputation: 8166

Java and Node.js (with several exceptions) can basically do the same back-end job, so IMHO it's over-complicated to use both of them, anyway I think you should first think about how many layers should your app have and then how you want to implement them.

You could for example have some ajax calls from your html5 pages to a REST interface implemented in Node.js, which in turn calls a Java WS, but again it all depends on what you want to do with this app.

Upvotes: 2

Related Questions