Home Blog

Build a simple Express server – JS Express

build express js server in nodejs
build express js server in nodejs

Express.js in JavaScript. The Express.js is the most popular web framework used for building web applications and APIs in Node.js Project. In this article we will learn how to create express server with nodejs. Before you start, make sure you have Node.js installed on your system. If not, you can download it from the official website: https://nodejs.org/

1. Setup Node Project

Create a folder named express-server open the folder in your favorite code Editor (VSCode), then run below cmd to make it a Node Project.

#initialize a Node Project

npm init -y

This cmd will convert a normal folder into a node project by creating package.json file it holds your project meta-data.

2. Create a server file

In root directory of project, create a file by name index.js.

Now to make a Express Server application we need to download & install Node Express Module into the project.

Run below cmd to install ExpressJS

npm install express

now import it on top on index.js file to create Node Express Application

const express = require('express');

//create express app
const app = express();

3. Add Middleware

In our Node Project, Let’s use 2 middleware

  1. One is to parse incoming request with JSON payloads.
  2. Second is to parse incoming request with URL-encoder payloads
const express = require('express');
const app = express();

// parse incoming request to JSON payloads.

//parse incoming request with URL-encoding 

4. Create an API router

Now lets create a root API that will send JSON data response whenever there is a request to root api.


res.status(200).json({message:"API CALLED..!"})


5. Creating Express Server & Listen for server

Now let’s make a server to listen to a particular port may be let’s say post 3000 address i.e http://localhost:3000/

const port = 3000;

   console.log("Server listening to port 3000");

6. Start a server

To start Node Express Server, Open terminal/cmd prompt & run node index.js be being in root directory of project.

node index.js

7. Make a API request

Visit http://localhost:3000/ in your browser to see the API response.

Related Article

Books Directory Project wirh NodeJS – CRUD operation using Mongoose MongoDB

How does MERN Stack Work

JSON in 2 minutes (JavaScript Object Notation)

Javascriot object notation json
Javascriot object notation json

What is JSON?

JavaScript Object Notation(JSON) is a standard text based data format used in application development to send and receive data in JSON format, JSON is basically used to transfer sets of data from server to client or vise versa, Here data is formatted in key-value pair and separated by using commas.

Example of JSON data format

{"firstName":"Rajat", "lastName":"Palankar"}

JSON Array of Object Example

    {"firstName":"Rajat", "lastName":"Palankar"},
    {"firstName":"Manoj", "lastName":"Anvekar"},
    {"firstName":"Peter", "lastName":"England"}

Where are JSON been used?

Now a days, JSON data is been to build various applications throught out the world in IT field, Here are few common area where JSON is used:

  1. Web APIs: JSON is most popular format for data exchanging between web servers and client application and are commonly used in building API’s like for example Weather service, Payment gateway, social media platforms.
  2. Data Storage: JSON are also used in NoSQL databases like MongoDb and CouchDB. The database store JSON documents and make it suitable choice to make application flexible and schema-less data storage.

IoT (Internet of Things): Now a days JSON data is been used in IoT applications also mainly for exchanging data between IoT devices and servers. As JSON data is lightweight it makes it suitable for resource-constrained devices.

Mobile App Development: JSON is commonly used in mobile app development for data storage, communication with APIs, and configuration files.

Data Transformation: JSON is used in data transformation processes where data is converted from one format to another. For example, ETL (Extract, Transform, Load) processes often involve transforming data into JSON format for easier processing.

and many more

Advantage of using JSON

  • It is a light weight database standard, so data transmission is much faster.
  • It can be used on all platforms.
  • It is supported by all programming langauges.

Data types supported in JSON

  • String
  • Number
  • Arrays
  • null
  • Boolean
  • Objects

JSON Methods in Javascript

JSON,parse(): Takes JSON String and convert it into JavaScript Object.

JSON.stringify(): Convert JavaScript Object(JSON) into JSON String (Useful while sending over the network).

JSON Syntax and Example

JSON syntax and example
  "name": "Rajat Palankar",
  "age": 30,
  "email": "rajatpalankare@example.com",
  "isSubscribed": true,
  "hobbies": ["reading", "hiking", "swimming"],
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "zipcode": "12345"

In this example:

  • JSON data is enclosed in curly braces {}.
  • Data is represented as key-value pairs, where the key is a string enclosed in double quotes, followed by a colon :, and then the corresponding value.
  • Strings must be enclosed in double quotes.
  • Numeric values don’t need quotes.
  • Boolean values are true or false.
  • Arrays are represented using square brackets [] and can contain multiple values of different types.
  • Objects (nested structures) can be used as values for keys, creating a hierarchical structure within JSON.

Recent Articles

How to read JSON file in flutter dart

Flutter Auto Create Model from JSON Files

How to parse JSON Data in Flutter

How to convert array to collection in Javascript

How is Artificial Intelligence Shaping the Future of Ecommerce?

AI in ecommerce application

Since its introduction, AI (Artificial Intelligence) has successfully found its applications in every industry and landscape. The ecommerce industry is no different. We have seen unprecedented growth of the ecommerce industry lately. 

Some eye-opening facts and figures reflect this unprecedented evolution of the ecommerce industry. 

Nearly 24 million ecommerce stores are active online. In 2021, the ecommerce sales grew by 27.6%. Moreover, in the same year, ecommerce sales saw a significant boom worldwide, and purchases worth $4.1 trillion were made online. 

This huge figure accounted for 19% of the worldwide sales. The revenue of the worldwide e-commerce industry is expected to grow to $8.1 trillion by 2026.

While several reasons played a role in the evolution of the e-commerce landscape, you can’t overlook the role of AI in this entire phenomenon. The ecommerce landscape is based on technology, and ecommerce retailers want to get the most out of technology to ensure an excellent online shopping experience and an exceptional increase in revenue. 

AI and its subsets like Machine Learning, NLP (Natural Language Processing), and Computer Vision are helping ecommerce retailers make it possible. The involvement of AI in the ecommerce landscape is already opening the gateway for us to the future. Thanks to AI, things that were considered impossible a few years back are now possible. 

Here is how AI is shaping the future of the ecommerce landscape. 

Visual search is the most obvious example of AI’s involvement in the ecommerce landscape. Customers often fail to find their desired products online through conventional search until they have all the necessary details. The voice search method may also fail to work in such a scenario. Conversely, the visual search method can help users find their desired merchandise easily. It is often observed that consumers like to take pictures of products they want to buy. 

They can easily find the exact product online and the vendor selling it with the help of the image of merchandise. All they need to do is perform a reverse image search online. Performing an image reverse search will help them find the exact product and other products that fall in the same category with better pricing. 

While reverse picture search utilities are available to help users find products, many ecommerce stores also offer the visual search feature to help users find their desired merchandise.

AI Chatbots

AI is not only limited to the visual search when it comes to its involvement in the AI landscape. AI has led to the development of NLP (Natural Language Processing), which enables computers to interact with humans and respond to them meaningfully. This NLP works behind AI chatbots that are available on ecommerce stores to respond to the queries of users. This application of AI has enabled ecommerce vendors to hire human resources for more complex human tasks.


In addition, AI chatbots are available to respond to queries 24/7, which means users can get quick answers without waiting for someone to view and answer their queries. This possibility helps ecommerce vendors ensure optimum user experience. Moreover, AI chatbots can also suggest various products. In case of complicated queries, these chatbots can connect customers to human customer support representatives capable of handling the matter more efficiently.

Automated Reminders

It is pretty frustrating for ecommerce retailers when a user spends significant time on a product page or adds a few products to the cart but leaves the site without performing the desired action, i.e., purchase. AI offers help to e-commerce vendors by letting them generate automated reminders for such users and enticing them to purchase products they have left in abandoned carts. These automated reminders are sent to users through email. The email copies sent as automated reminders feature captivating words.

AI in ecommerce

These reminders can help users realize what they are actually missing by not purchasing the products. Moreover, these automated reminders may feature discount codes to compel them to visit the website again and reach the checkout page to complete the purchase. These automated reminders may also request feedback to enquire about the reasons behind the abandoned cart. Simply put, AI-backed automated reminders can help ecommerce retailers boost conversions. 

Personalized Shopping Experience

Everyone likes special treatment while shopping for products from a brick-and-mortar outlet or an ecommerce store. Brick-and-mortar outlets hire sales executives who guide buyers about various products and recommend products based on their requirements, purchase history, and preferences. Online retailers can use AI and machine learning to boost their conversions. Many e-commerce retailers use it to increase their sales and achieve fruitful results. 

AI and machine learning help e-commerce retailers understand the purchase patterns of existing users. Moreover, virtual shopping assistants are employed to understand the requirements of newcomers. An understanding of purchase patterns helps ecommerce retailers upsell and cross-sell products easily. This process impresses customers and helps e-commerce retailers increase their revenue. Hence, an AI-backed personalized shopping experience is a win-win solution for both parties.

JavaScript – Currency Number Formatting using Intl.NumberFormat

Javascript - Number to Currency Fornat using Intl NumberFormat
Javascript - Number to Currency Fornat using Intl NumberFormat

Hi Guy’s Welcome to Proto Coders Point, In this article let’s check put how to convert number to currency format number in javascirpt using Intl.NumberFormat.

In the world web development, we make use of javascript, and if you are building any application where you want to want to format a number into a currency number format, specially when you want to show the number in a form of item price in currencies. To ensure consistent and user-friendly experience, software developers need to format numbers according to user’s locale & the currency he/she is preference. In javascript to convert normal number into currency number is simple and straightforward using `Intl.NumberFormat` object.

Video Tutorial

Currency Number Formatting using Intl.NumberFormat

Introduction to Intl.NumberFormat

The Intl.NumberFormat is a Internationalization API which comes with all the web browsers, using which software developers can format number according to their needs may be in locale or currency format, It has flexiable option to customize the number in terms of how the number is displayed to the end users.

The Code – Javascript number formating in currency format with currency symbol

const price = 10000000;


console.log("US -> ", Intl.NumberFormat('en-US').format(price));
console.log("IN -> ", Intl.NumberFormat('en-IN').format(price));

console.log("US with symbol -> ", Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'USD'

console.log("IN with symbol -> ", Intl.NumberFormat('en-IN', {
    style: 'currency',
    currency: 'INR'

Let’s break down above code in part for better understanding:

  1. Default Number formating: The first 2 line demonstrate the simple usage of ‘Intl.NumberFormat’. In log i have use it, it formats the price variable which is a number into currency number format using default locale.
  2. Locale-Specific Formating: The next 2 line is to demostrate how to format to number for specific locales. NumberFormat() i am passing locate code i.e en-US for United States and en-IN for India.
  3. Currency Number formating with Currency Symbol: The last 2 example code is to give styling for the number. The style property is set to 'currency', and the currency property is used to specify the currency symbol and code. The code formats price as US Dollars (USD) for the United States and Indian Rupees (INR) for India, including currency symbols.


In this article, we have explored how to use Intl.NumberFormat object in Javascript to format numbers into currency. Whether you or you company is build an e-commerce platform, financial application or any other application that requires currency number format to be displayed, Intl.NumberFormat() is your go-to solution to build user-friendly application.

Similar Article

Flutter display digits in currency format

Debouncing in flutter – A Effective way to implement search field

flutter debouncing
flutter debouncing

Hi Guys, Welcome to Proto Coders Point This flutter article is on what is debouncing & how to implement it in flutter.

What is Debouncing?

Debouncing is a effective way to implement searching functionality. Basically Debouncing is a technique by which we can control and manage user input by preventing unnecessary hits to server API.

When is debouncing used?

Debouncing is usually used in search fields, such as when a user type a letter in a textField, A API is called and then a fetched results from API is displayed.

Just consider that you are calling a API when there is a key pressed (user types a letters) onChanged method is used in Flutter TextField, Let’s assume that a user types a word dog in the search field, Here for each letter typed by user onChanged() method makes a call to API means 3 times API is called, which is not a right way to implement search field. This creates a rapid and unnecessary operation like network api call request or state updates. To prevent this we make use of Deboucing in flutter.

Debouncing was build to create a delay before performing request event for user input. There a a delay in user typing a letter, So when a user continuously types word “dog” and then keep a gap of 500 milliseconds, Now the API is triggered making it a more effective way to implement searching field in flutter.

How to implement debouncing in flutter?

Here are steps to implement debounce in flutter.

First let create a Timer() object will name it as _debounceTimer.

Timer? _debounceTimer;

Then in TextField we have a method onChanged() a listener that listens to each key/letter press or cleared by user in textField

          controller: _controller,
          onChanged: (text) {
               print('Making API Call for Text: $text (${text.characters.length})');
          decoration: InputDecoration(labelText: 'Enter text'),

In above code onChanged() method listens to each letter types in textField, That makes a call to a API on eack key press. To prevent this will make use of debouncing technique that is simple keeping a time gap before making a call to the server API.

          controller: _controller,
          onChanged: (text) {
              if (_debounceTimer != null) {

           _debounceTimer = Timer(Duration(milliseconds: 500), () {
                    // Perform your desired action here, e.g., make an API request.
                    print('Performing action with text: $value');
          decoration: InputDecoration(labelText: 'Enter text'),

In above example, Then a user types letters in textField rapidly the timer object reset itself so the API call is not made, and if the user keep a gap of 500 millisecond period within his typing speed then API call is made like searching a list of data that started with letter typed by user in textField.

Complete code – debouncing in flutter

import 'package:flutter/material.dart';
import 'dart:async';

void main() {

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DebounceExample(),

class DebounceExample extends StatefulWidget {
  _DebounceExampleState createState() => _DebounceExampleState();

class _DebounceExampleState extends State<DebounceExample> {
  final TextEditingController _controller = TextEditingController();
  Timer? _debounceTimer;

  void dispose() {

  void _onTextChanged(String value) {
    // Debounce the text input by delaying the action for 500 milliseconds.
    if (_debounceTimer != null) {

    _debounceTimer = Timer(Duration(milliseconds: 500), () {
      // Perform your desired action here, e.g., make an API request.
      print('Performing action with text: $value');

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Debounce Example'),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: TextField(
          controller: _controller,
          onChanged: _onTextChanged,
          decoration: InputDecoration(labelText: 'Enter text'),

Most Utilized API Protocal Architecture

Most Utilized API Protocal Architecture
Most Utilized API Protocal Architecture

Now a day in tech industry, Several API(Application Programming Interface) protocols and architectures are been widely used to build application. Keep in mind that this protocols has evolved more popularity since then. Her are some of the most utilized API protocols in industries right now.

1. MQTT (Message Queuing Telemetry Transport)

If an Lightweight & efficient messaging protocol that is specially built for low-bandwidth, high-latency or unreliable network. The MQTT protocol is originally developed by IBM in 1990’s and from that time to current time it is been widely used in Internet of Things(IoT) basically it is an publish-subscribe messaging protocol for efficient data exchange between devices using mqtt secure order.
( MQTT a best for option for IOT to application communication in real-time)


2. GraphQL

This technology is an Query language that allows clients to request exactly the data that is needed, The GraphQL API’s is built that enables a client to request specific set of data and reduce fetching extra or under-fetching(means data getting lost can be handled here).
(Query Language for flexible data retrieval.)


3. SOAP (Simple Object Access Protocol)

SOAP is a protocol that is used in exchanging structured information for web services. In SOAP it use XML format for messages. SOAP can handle various lowe-level protocol which Include HTTP, SMTP and more.
(Web Service Protocol for structured data exchange)


4. Webhook

A Webhook uses event or trigger based real-time data to another application. Webhook basically enable a way of communication between systems by allowing one system to provide data to another system. Webhook is simple words are HTTP callbacks that send real-time data to a specified URL when a specific event occurs.
( Event Notification Mechanism)


5. REST (Representational State Transfer)

This Architecture is a designed networded application with is standardized HTTP methods(like GET, POST, PUT and DELETE). REST API’s usually used JSON format data to communicate.
( Web Service Architecture for stateless communication)


6. WebSocket

A WebSocket are Full-duplex communication protocol over a single TCP connection, allowing interactive and real-time data exchange.
( Real-time Communication Protocol.)


Recommended Book