Accessing API From Browser Node.JS (Using the npm Library Express)

Accessing API From Browser Node.JS (Using the npm Library Express)

Handle the information from the browser. In this blog, we will go through the process of creating an API endpoint and access to them from the browser and send a response based on the information we received.

Handle the information from the browser.

What is the scope of this blog?

In this blog, we will go through the process of creating an API endpoint and access to them from the browser and send a response based on the information we received.

In this first part, we will explain how the info is sent from the browser using the Query string and how the server can access this info and used them.

In the second part, we will see how the sever accessing this info can use them to send a response to the browser to display info on the screen to the user.

When it comes to the server, and client-side one of the most complex and fascinating part is how does two communicate with each other and requesting and sending information.

The first step is that the browser communicates with the server and passing along some information. The server needs to collect this informations and use them to generate a response to fire back to the browser, which will display this information on the screen for the user. To be able to do that we need to learn how to create your HTTP JSON endpoint using Express.

How the browser sends info to the server?

Our first challenge is to be able and understand how the browser sends info to the server. To do this, we will use the Query string, which is an extension of the URL that provides additional value to pass along with the request.

Let’s build an example of info sent with a Query string to the server. In our code environment, we need to create an endpoint for products.

Image for post

javascript nodejs request responses endpoints

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Decoding Nodejs

The main goal of this blog is to explain the “Architecture of Nodejs” and to know how the Nodejs works behind the scenes. Generally, most of the server-side languages, like PHP, ASP.NET, Ruby, and including Nodejs follows multi-threaded architecture. That means for each client-side request initiates a new thread or even a new process.

Hire NodeJs Developer

Looking to build dynamic, extensively featured, and full-fledged web applications? **[Hire NodeJs Developer](https://hourlydeveloper.io/hire-dedicated-node-js-developer/ "Hire NodeJs Developer")** to create a real-time, faster, and scalable...

JavaScript Shopping Cart - Javascript Project for Beginners

JavaScript Shopping Cart - javascript shopping cart tutorial for beginnersBuy me a coffee 🍺 https://www.paypal.com/paypalme/ziddahSource Code: https://bit....

The essential JavaScript concepts that you should understand

The essential JavaScript concepts that you should understand - For successful developing and to pass a work interview

What is ECMAScript and How is it Different From JavaScript?

Many times developers use JavaScript and ECMAScript synonymously for each other. Though they are very closely linked to each other, it does not mean they are the same thing.here is a complete story on the history of JavaScript and how it came into existence. To cut the long story short, ECMA in ECMAScript refers to Europen Computer Manufacturers Association to which JavaScript 1.1 was submitted for standardization back in the year 1997.