'Sup world,
I’ve been wondering about Nodejs/Server Side languages for a while now. What is it used for exactly? I know can be used for hosting with routing. But I can do that with github pages. I know it can be used for apis, but usually in an app you aren’t making an api, right? Is it really only for use with mongodb? Thanks for the info.
Think of this, every morning your app goes and checks wheather somewhere on Mars and adjust css theme accordingly; or your app wants to store something privately; or you want to develope app in modular approach and then bundle all the code… this is just a few examples
Can’t you use js to do some of that, or is it that its easier node?
Node got a language that works only in the browser (javascript) and make it work outside the browser. Now you can do everything with it, just like python, c, c++, c#, java, etc…
You can do command line apps, a backend for your website, or anything.
I think the main benefit is to use a single language (javascript) in the frontend and the backend. You can even share code between those two. This was not possible before node, sometimes you had to duplicate logic because you couldn’t share the code.
Just to give you an example, image a form validation, generally you do it in the frontend so it’s easier for your users to see what’s wrong in real time. But you must validate on the server (because the client is never safe). With node, you write that validation in one place and both the client and the server can use it.
My question was really server side in general, not just the node language. i’ll edit my question above.
Jumped from Laravel to NodeJS never felt happier in my coding world.
You can use any language you want on server side as long as it creates API for front-end requests. JavaScript is arguably a “language for beginners” and therefore Node.js allows for beginners to create more complex systems that include back-end interactions.
I’m not sure I agree that Node is a language, it’s a runtime working on V8 engine which is in turn an API of a computer or server created to understand Javascript: consider this, your computer will never understand JavaScript unless you will open a browser, in the same way server will never understand JS until you run Node.js
You need server side for anything but the very basic. Suppose this forum, you need server side to store every profile, every topic, every message, every likes, shares, reports and bookmarks.
Every one of those things also needs to be validated, you can’t allow a person to send more than one like per post for example. And you can’t trust the client (frontend) to validate it. Every client, be it a website or a software app running in your desktop, isn’t trustable because someone is running the code (your app) in their computer, they can modify that code to do what they want.
The only thing you can trust is your backend, because it is running your code in your server. So you must validate everything the client sends to you.
I’m probably going overboard here, you should create an app that uses frontend and backend so you’ll understand it better. Search a tutorial that shows you how to create a “CRUD” app, it is the simplest form of interaction between frontend and backend, you’ll learn a lot.
Nope, that was perfect. Thanks a lot.