API'S, Web Sites VS Web Apps

·

2 min read

API'S, Web Sites VS Web Apps

Website vs Web Application

Website: Static HTML pages like blogs, portfolio websites...

Web Application: Dynamic behavior and can install as an application like youtube, LinkedIn...

A web application consists of 3 parts:

1) Frontend (java, react, angular, Python)

2) Backend (spring, nodejs, Django)

3) Database (SQL, MongoDB)

Node js is a run time environment for javascript. Earlier js are only executed in browsers. But by node, we can execute js locally.

Express is a Node js framework to create backend api's which handle requests and responses.

API's

Application Programming Interface which is intermediate to communicate between client and server. For transferring data we can use these api's.

Soap API

Simple Object Access Protocol In the Earlier days we use this which was dependent on XML to transfer the data from client to server.

But later on, using this API what understood is it's very slow. Because XML has a lot of metadata. Forex to transfer a single variable name='suriya' we have to send this whole bunch.

<svg>

<variableSets xmlns="http://ns.adobe.com/Variables/1.0/">

<variableSet locked="none" varSetName="binding1">

<variables>

<variable varName="name" trait="textcontent" category="http://ns.adobe.com/Flows/1.0/"/>

</variables>

<v:sampleDataSets xmlns:v="http://ns.adobe.com/Variables/1.0/" xmlns="http://ns.adobe.com/GenericCustomNamespace/1.0/">

<v:sampleDataSet dataSetName="Data Set">

<name>

<p>suriya</p>

</name>

</v:sampleDataSet>

</v:sampleDataSets>

</variableSet>

</variableSets>

</svg>

So then Comes:

REST API: REPRESENTATIONAL STATE TRANSFER

This means that when a client requests a resource using a REST API, the server transfers back the current state of the resource in a standardized representation.

REST API uses JSON format which is simple, flexible and fast.

EX-

{   
    name: "suriya"            
}

RESTFUL = [Type Of Request, api]

Type of HTTP requests ---> get, post, update, delete

A RESTful API allows clients to utilize various types of HTTP requests (GET, POST, PUT, PATCH, DELETE) to interact with resources exposed by the API. It provides a standardized and scalable approach to building web services and APIs.

[GET, /hashnode/articles]

[POST, /hashnode/article]

[UPDATE, /hashnode/article/1]