This is a rookie tutorial, this is a rookie tutorial, if you are a rookie.
Simply put, Nodejs is not a new language, but it can allow our JS to run on the server side, write JS code on the server side and input and output. That is to say, if someone asks you whether JS can only run in the browser in the future, don't say it, alas, yes.
I remember when I first started learning HTML, CSS, and JS, my first impression was to download various browsers because of the compatibility problem T_T, but now there is good news to learn Nodejs and it has no compatibility problem.
If you want to know why Nodejs has no compatibility issues, then you will first understand why there are compatibility issues in the front-end. Here I mentioned that the front-end is trying to say that Nodejs is not the front-end, but the back-end. Although it looks very similar, I regret to tell you that it is not.
If you are too far-fetched, you will get to the point. Why are there compatibility issues in the front-end? The main problem is the browser! ! ! Do you think, each browser is made from a different factory, can the effect be the same? Later, everyone was dissatisfied. You said that what you wrote can only be used in his home, but it won’t work in other people’s homes. Damn, what is the law of nature? So later a third party came out, which is what we call W3C. This W3C is specifically responsible for solving this problem. What is the problem? That is to say, as an intermediary, W3C is responsible for defining standards, and their browsers must provide APIs for us programmers to use according to their standards. Then why are there still compatibility issues? Having said that, they just set standards, but do others have to do what they do? It's so naive.
But don’t worry, there will be less and less compatibility in the future. Why? You think, most browsers provide the same APIs, but what you provide is different. Can developers be happy? If developers are unhappy, who is willing to use their browser? No matter how much they commit crimes, they will be self-destructive. Let’s take a look at IE many years ago and IE today.
OK, then again, since these compatibility issues are all done by the browser, Nodejs does not need a browser anymore, so what is compatible with, right? Since that's the case, the BOM and DOM we learned before naturally cannot be used in Nodejs, because there is no browser anymore, what else do you operate DOM? Another very important thing is that Nodejs allows us to operate local files, which is very important. It is a pity that a language cannot operate files. If you want JS to operate files, it can do it, but the browser dare not let JS do this because it is too dangerous. For example, when you visit a person's website, it writes a program in JS to delete things in your computer system, or read your privacy. This is amazing, but the server side is different, because the code you write is only run in your own server. Could it be that you destroy your computer? Is it a little messy? All right.
Let’s summarize what I learned today: Nodejs allows JS to be used in the server. Because there is no browser addition, there is no compatibility issue. Naturally, there is no BOM and DOM, and it can operate local files.
The above must-read tutorial for Nodejs from taking off from a rookie without a chance is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.