Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 1, 2023 08:35 pm GMT

What are Client and Server Sides?

Hi, I'm Subham Maity, a software engineer. I also enjoy teaching others how to code through my tutorials. I'm always eager to learn new things and share my knowledge with the community.

I recently wrote an article on What are Client and Server Sides? and wanted to share it with you all. You can find the article on my website https://codexam.vercel.app/docs/node/node1 [Better View]

I also have a repository on GitHub where you can find all the code and projects related to this topic. You can find the repository at https://github.com/Subham-Maity/node-js-full-stack-tutorial

For a more in-depth look at this topic, including a detailed table of contents, check out the complete tutorial on my GitHub Repo

If you want to stay updated with my latest projects and articles, you can follow me on:

Client-side code runs on the user's web browser, while server-side code runs on the web server. For example:

  • Client-side code can use HTML, CSS, and JavaScript to create the web page layout, style, and interactivity. It can also fetch data from the server using AJAX.
  • Server-side code can use Node.js or other languages to handle requests from the client, access the database, and send back data. It can also run business logic and authentication.

A real-world example is Gmail. The client-side code loads the web page and sends requests to the server-side code to fetch your emails. The server-side code validates your identity and sends back the data to the client-side code.

How NodeJs use JavaScript?


example

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine, which allows JavaScript to be executed outside of a browser environment.

V8 JavaScript Engine: Node.js uses the V8 engine to compile and execute JavaScript code. This engine was originally developed by Google for their Chrome browser, and it provides high-performance execution of JavaScript code outside of the browser. Ryan Dahl (the creator of Node.js) used the V8 engine to create Node.js. Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine, which allows JavaScript to be executed outside of a browser environment.

Here's an example of how Node.js uses JavaScript:

If you can't understand the code, don't worry. We'll explain it later.

// This is a simple Node.js HTTP server that responds to requests with "Hello, World!"const http = require('http'); // Import the Node.js HTTP moduleconst server = http.createServer((req, res) => {  res.writeHead(200, {'Content-Type': 'text/plain'}); // Set the response headers  res.write('Hello, World!'); // Write the response body  res.end(); // End the response});server.listen(3000); // Start the server on port 3000

What developer Make with Node Js?


example

First request is coming from client like browser, Android, IOS etc then that request is send to server and then server connect to the database and file server and get the data and send it to the client.

  • Developers Make API with Node js> API in simple words is a set of rules that allow two software programs to communicate with each other. When you send a request to a server, the server sends back a response. The request and response are both in the form of an API call. For example, when you search for a product on Amazon, the server sends back a response that contains the product information. This response is an API call.
  • So we can connect Server with Client
  • Node can make API for web, Android and IOS etc.
  • Make can also make website

Original Link: https://dev.to/codexam/what-are-client-and-server-sides-1e30

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To