I am planning to start making my first big web project. I am currently at the point where I am trying to visualize everything but some of the technologies will be learned on the run. I recently picked up JavaScript and learned a bit of Node.js.
I wanted to make a rest API in java, that connects to a Mysql database. After doing some unwanted research, I came across a statement which to me seem bold. That node.js can in some way pletely replace java as a backend?
For what i know Node.js is a runtime envioronment based of chromes JavaScript engine, with some libraries like NPM. (which I yet have to look into some more)
That was a long introduction, the core of my question is: Can Node.js replace Java in my case, and if so why and how?
I am planning to start making my first big web project. I am currently at the point where I am trying to visualize everything but some of the technologies will be learned on the run. I recently picked up JavaScript and learned a bit of Node.js.
I wanted to make a rest API in java, that connects to a Mysql database. After doing some unwanted research, I came across a statement which to me seem bold. That node.js can in some way pletely replace java as a backend?
For what i know Node.js is a runtime envioronment based of chromes JavaScript engine, with some libraries like NPM. (which I yet have to look into some more)
That was a long introduction, the core of my question is: Can Node.js replace Java in my case, and if so why and how?
Share Improve this question edited Oct 31, 2018 at 8:48 Jonas Grønbek asked Oct 18, 2018 at 20:37 Jonas GrønbekJonas Grønbek 2,0494 gold badges29 silver badges58 bronze badges 8- 1 People try but I wouldn't suggest it. There's plenty of other languages and frameworks available for a slim REST API application if that's is what you need and do not want to use Java. – Hayden Commented Oct 18, 2018 at 20:41
- 1 Yes, Node.js can run server-side and make connections to databases, as well as serve content via endpoints, if that's what you wish. You can look into Express for an implementation of server technology. Whether or not Node would be capable of replacing Java for your use-case would depend on your actual use-case. Java EE can be quite powerful in a very large application, for example. – VLAZ Commented Oct 18, 2018 at 20:42
- 2 I don't think a server running Node is unmon. In fact, I think it might be by far the most mon thing to use Node for, although I don't have any numbers to back this up. There is the MERN stack (MongoDB, Express, React, Node.js) which is popular right now for web apps. Previously the MEAN stack (Angular instead of React) was more popular. Both are still in use. You can also mix and match other technologies but these seem to be very frequently used together - enough to have their own acronyms. – VLAZ Commented Oct 18, 2018 at 20:48
- 1 NodeJs is very popular nowadays for server application & no doubt will be more used in the future. But, you need to keep in mind that NodeJs works better with NoSql databases you'll have a hard time connecting an sql server with your nodejs application. – Melchia Commented Oct 18, 2018 at 20:50
- 3 @Melchia That is actually not true. We use a relational database (postgres) with no more plexity than nosql. The decision to use nosql vs rdbms is not one of "one being easier than the other", but it should solely depend on that data you're attempting to persist. Just blindly using nosql can lead to a world of trouble later on. – dvsoukup Commented Oct 18, 2018 at 21:20
1 Answer
Reset to default 5Some personal thoughts:
Can Node.js replace Java in my case, and if so why and how?
Definetly. Nodejs is not just V8 with some libraries, but also ships with a lot of ways to interact with the IO, which means you can run http(s) servers, connect to databases and other servers, spawn threads, write/read files among others. If there is some low-level thing that the JVM supports that Nodejs doesn't, you can just write a native binding in C++ (or take one from NPM, there is probably already one for your exact usecase).
The main benefit of Nodejs is that you just write JavaScript, and you don't have to change languages. That makes development more easy and faster (at least for me).