-5

I'm pretty new to web development, and i don't really know what does it mean that it works on the server side. Does it mean that it's doing the hard server work, like catching requests, and the node file isn't the server?

thekensiwo
  • 17
  • 4
  • 2
    What is the node file? BTW, you know about the client-server model, right? – D. Pardal Aug 24 '20 at 19:53
  • 2
    https://www.geeksforgeeks.org/client-server-model/ – epascarello Aug 24 '20 at 19:56
  • I meant the file where the js code is, i know the client-server model – thekensiwo Aug 24 '20 at 20:00
  • Try an internet search.. https://www.google.com/search?q=what+does+server+side+node.js+mean — even preserving much of the literal question returns relevant results which would be worthwhile to read. These include terms and how Node.js is normally used in this case (as an “HTTP server running server-side on a remote server from from a client-side browser”). – user2864740 Aug 24 '20 at 20:07
  • Does this answer your question? [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – ChrisGPT was on strike Aug 25 '20 at 00:20

3 Answers3

1

What does it mean that node works on server side?

In a typical client/server web application, you have the browser as the client and a web server as the server. The two are completely separate. The browser runs on the user's computer. The server runs in some data center/hosting facility. One of the more popular uses for nodejs is to create a web server that fulfills the server-side of the client/server architecture.

The user types a URL into a browser (or hits a bookmark or clicks a link somewhere). This causes the browser to make an http request to the server in the URL. If the URL was https://www.google.com/maps, then the browser would use DNS to get the IP address of www.google.com. For this to work, a server must be listening on port 443 (which is the default port for https). The browser would then create a TCP connection (in this case using SSL for security) to that IP address and then send an HTTP GET request over that TCP connection.

The server would then receive that HTTP GET request for the resource /maps and would respond by sending an HTML page back to the browser.

In this example, nodejs could be used for the web server, though it can be used for any type of server and can even be used for non-server things too, such as programs/scripts you run on your own computer. For example, I have several build scripts and disk housekeeping scripts that I run on my computer that are written in nodejs.

Nodejs uses Javascript as its language, but this is not to be confused with Javascript that runs in the browser. While the core language is the same in the two (they both use the V8 Javascript engine), no node.js code actually runs in the browser. Nodejs code must run in the nodejs runtime, not the browser runtime. This is because both the browser and nodejs add their own runtime-relevant features to the Javascript environment.

For example, the browser has a window object and a document object and all the relevant properties and methods on those that help a client-side programmer access aspects of a live web page in the browser. Nodejs adds things like an http server library, a TCP library, DNS library, etc... things that are not available in the library and are necessary for server-side development.

Note: It is possible to write code in nodejs that functions as a client. This would not be a browser client, but you can write code in nodejs that makes requests to other servers, fetches data, processes that data and then does something with it. For example, you could write a program that would fetch new email from a GMail account (if you had the proper credentials for the account) and then process that email somehow. In cases like this, nodejs would actually be functioning as the client, not as the server.

jfriend00
  • 683,504
  • 96
  • 985
  • 979
0

Server-side is referring to the server part of the client-server model. Generally speaking, it's the central data store, which enables clients to access the same data.

It does generally make sense to cache server-side, and to do the heavy lifting there (depending on what sorts of clients you have), but ultimately that's a design decision.

Joundill
  • 6,828
  • 12
  • 36
  • 50
-2

It is an extended version of JavaScript that enables back-end access to databases, file systems, and servers. Server side javascript, is javascript code running over a server local resources , it's just like C# or Java, but the syntax is based on JavaScript.

Bozho
  • 41
  • 1
  • 2
  • 7
  • 2
    Not sure what you mean by "extended version of JavaScript". It's a runtime for JavaScript that allows you to execute JavaScript code outside of a web browser. – jarmod Aug 24 '20 at 20:07