Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Intro To Back-End Dev & Node Js

This document provides an introduction to backend development and Node.js. It discusses what backend development is, introduces Node.js and its uses, explains what APIs and REST APIs are, discusses different API architectures, and how to create a simple REST API using Express.js.

Uploaded by

nanda adis
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Intro To Back-End Dev & Node Js

This document provides an introduction to backend development and Node.js. It discusses what backend development is, introduces Node.js and its uses, explains what APIs and REST APIs are, discusses different API architectures, and how to create a simple REST API using Express.js.

Uploaded by

nanda adis
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Module 03

Full Stack Web Development

Intro to Back-End
Development & Node JS
Outline

● Intro to Back-End Development


● Intro to Node JS
● Intro to REST API
● API architectures
● Intro to Express JS
● Create simple REST API
● Testing with REST client app
● Network Protocol & HTTP Methods
What Is Back End Development?

Backend development means working on server-side application, which focuses on everything you
can’t see on a website. Back-end developers ensure the website performs correctly, focusing on
databases, back-end logic, application programming interface (APIs), architecture, and servers. They
use code that helps browsers communicate with databases, store, understand, and delete data.

REST API

Desktop / Mobile Client Server


Introduction to NodeJs

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine (written in C++). Node.js uses
an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package
ecosystem, npm, is the largest ecosystem of open source libraries in the world.

● A platform which allows us to run Javascript on computer/server.


● Read, delete & update files.
● Easily communicate with database.

We use NodeJS as a backend in web development.

Src: https://nodejs.dev/learn
What is API ?

API stands for Application Programming Interfaces. APIs are mechanisms that enable two software
components to communicate with each other using a set of definitions and protocols.

For example, the weather bureau’s software system contains daily weather data. The weather app on
your phone “talks” to this system via APIs and shows you daily weather updates on your phone.

You can think of an API as a gateway between clients and resources on the web.
API Architectures

API architecture is usually explained in terms of client and server. The application sending the request
is called the client, and the application sending the response is called the server. So in the weather
example, the bureau’s weather database is the server, and the mobile app is the client.

There are many different ways that APIs can work depending on when and why they were created.
API Architectures

SOAP Websocket

These APIs use Simple Object Access Protocol. Client and Websocket API is another modern web API development that
server exchange messages using XML. This is a less flexible uses JSON objects to pass data. A WebSocket API supports
API that was more popular in the past. two-way communication between client apps and the server.
The server can send callback messages to connected clients,
making it more efficient than REST API.

RPC REST

These APIs are called Remote Procedure Calls. The client These are the most popular and flexible APIs found on the
completes a function (or procedure) on the server, and the web today. The client sends requests to the server as data.
server sends the output back to the client. The server uses this client input to start internal functions
and returns output data back to the client.
What is REST API ?

REST stands for Representational State Transfer. REST defines a set of functions like GET, PUT, DELETE,
etc. that clients can use to access server data. Clients and servers exchange data using HTTP.

The main feature of REST API is statelessness. Statelessness means that servers do not save client
data between requests. Client requests to the server are similar to URLs you type in your browser to
visit a website. The response from the server is plain data, without the typical graphical rendering of a
web page.
Create Simple REST API with NodeJS
Create Simple REST API with NodeJS
Introduction to ExpressJS

Express is a minimal and flexible Node.js web application framework.

The Express philosophy is to provide small, robust tooling for HTTP servers, making it a great solution
for single page applications, websites, hybrids, or public HTTP APIs.
Create Simple REST API with ExpressJS

1. First, create a project directory then

$ npm init –-y

2. Installation

$ npm install express --save


Create Simple REST API with ExpressJS
Testing with client app

1. Download and open POSTMAN


https://www.postman.com/product/rest-client/
2. Write down your web server port (ex: localhost:8000/api) in url field.
3. Hit enter to see the response.
Network Protocols

A protocol is a set of rules. The network protocols are formal standards and policies, made up of
restrictions, procedures, and formats, that define the exchange of data packets to achieve
communication between two servers or more devices over a network.

Types of protocols :
● Transmission Control Protocol (TCP)
● Internet Protocol (IP)
● User Datagram Protocol (UDP)
● Post office Protocol (POP)
● Simple mail transport Protocol (SMTP)
● File Transfer Protocol (FTP)
● Hyper Text Transfer Protocol (HTTP)
● Hyper Text Transfer Protocol Secure (HTTPS)
● Etc …
HTTP Request Methods

HTTP defines a set of request methods to indicate the desired action to


be performed for a given resource. Although they can also be nouns,
these request methods are sometimes referred to as HTTP verbs.
HTTP Request Method

GET

● The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.

POST

● The POST method submits an entity to the specified resource, often causing a change in state or side effects on the server.

PUT

● The PUT method replaces all current representations of the target resource with the request payload.

DELETE

● The DELETE method deletes the specified resource.

PATCH

● The PATCH method applies partial modifications to a resource.


Exercise

Create REST API using ExpressJS with all HTTP request methods.
Thank You!

You might also like