0% found this document useful (0 votes)
5 views

Backend PPT

The document provides an overview of backend development using Node.js, including its features, modules, and examples for creating web applications. It covers various aspects such as the Node.js runtime environment, asynchronous I/O, server creation, debugging, and working with packages using Node Package Manager (NPM). Additionally, it discusses error handling, DNS, networking, cryptography, and other essential functionalities within Node.js.

Uploaded by

Kartik Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Backend PPT

The document provides an overview of backend development using Node.js, including its features, modules, and examples for creating web applications. It covers various aspects such as the Node.js runtime environment, asynchronous I/O, server creation, debugging, and working with packages using Node Package Manager (NPM). Additionally, it discusses error handling, DNS, networking, cryptography, and other essential functionalities within Node.js.

Uploaded by

Kartik Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 187

Backend Development

● Node JS
● MySQL
● MongoDB
● Express JS
Table of Contents
● Introduction.
● Features.
● Node JS
● Node JS with MySQL
● Node JS with MongoDB
● Express JS
INTRODUCTION
• Node.js is a cross-platform runtime environment and library
for running JavaScript applications outside the browser. It is
used for creating server-side and networking web applications.
It is open source and free to use.
• Many of the basic modules of Node.js are written in JavaScript.
Node.js is mostly used to run real-time server applications.
• Node.js is a platform built on Chrome's JavaScript runtime for
easily building fast and scalable network applications. Node.js
uses an event-driven, non-blocking I/O model that makes it
lightweight and efficient, perfect for data-intensive real-time
applications that run across distributed devices.?
• Node.js also provides a rich library of various JavaScript
modules to simplify the development of web applications.
FEATURES
1. Extremely fast: Node.js is built on Google Chrome's V8 JavaScript Engine, so its library
is very fast in code execution.
2. I/O is Asynchronous and Event Driven: All APIs of Node.js library are asynchronous
i.e. non-blocking. So a Node.js based server never waits for an API to return data. The
server moves to the next API after calling it and a notification mechanism of Events of
Node.js helps the server to get a response from the previous API call. It is also a reason
that it is very fast.
3. Single threaded: Node.js follows a single threaded model with event looping.
4. Highly Scalable: Node.js is highly scalable because event mechanism helps the server
to respond in a non-blocking way.
5. No buffering: Node.js cuts down the overall processing time while uploading audio and
video files. Node.js applications never buffer any data. These applications simply output
the data in chunks.
FIRST EXAMPLE
Node.js console-based Example
File: console_example1.js

console.log('Hello Board Infinity');

Open Node.js command prompt and run the following code:

node console_example1.js
FIRST EXAMPLE
Node.js web-based Example
A node.js web application contains the following three parts:

1. Import required modules: The "require" directive is used to load a Node.js


module.
2. Create server: You have to establish a server which will listen to client's
request similar to Apache HTTP Server.
3. Read request and return response: Server created in the second step will
read HTTP request made by client which can be a browser or console and
return the response.
How to create node.js web applications

Follow these steps:

1. Import required module: The first step is to use ?require? directive to load http
module and store returned HTTP instance into http variable. For example:

var http = require("http");

2. Create server: In the second step, you have to use created http instance and call
http.createServer() method to create server instance and then bind it at port 8081 using
listen method associated with server instance. Pass it a function with request and
response parameters and write the sample implementation to return "Hello World". For
example:
http.createServer(function (request, response) {

// Send the HTTP header

// HTTP Status: 200 : OK

// Content Type: text/plain

response.writeHead(200, {'Content-Type':
'text/plain'});

// Send the response body as "Hello World"

response.end('Hello World\n');

}).listen(8081);

// Console will print the message

console.log('Server running at http://127.0.0.1:8081/');


Combine step1 and step2 together in a file named "main.js".
File: main.js
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type':
'text/plain'});
// Send the response body as "Hello World"
response.end('Hello World\n');
}).listen(8081);
/ Console will print the message
console.log('Server running at
http://127.0.0.1:8081/');
How to start your server:

Go to start menu and click on the Node.js command prompt.


Now command prompt is open:
Set path: Here we have save "main.js" file on the desktop.

So type cd desktop on the command prompt. After that execute the main.js to start the
server as follows:

node main.js
Now server is started.

Make a request to Node.js server:

Open http://127.0.0.1:8081/ in any browser. You will see the following result.
NODE.JS CONSOLE
The Node.js console module provides a simple debugging
console similar to JavaScript console mechanism provided by
web browsers.

There are three console methods that are used to write any
node.js stream:

1. console.log()
2. console.error()
3. console.warn()
Node.js console.log()
The console.log() function is used to display simple message on console.

File: console_example1.js

console.log('Hello Board Infinity’');

Open Node.js command prompt and run the following code:

node console_example1.js
We can also use format specifier in console.log() function.

File: console_example2.js

console.log('Hello %s', 'Board Infinity');

Open Node.js command prompt and run the following code:

node console_example2.js
Node.js console.error()
The console.error() function is used to render error message on console.

File: console_example3.js

console.error(new Error('Hell! This is a wrong method.'));

Open Node.js command prompt and run the following code:

node console_example3.js
Node.js console.warn()
The console.warn() function is used to display warning message on console.

File: console_example4.js

const name = 'John';

console.warn(`Don't mess with me ${name}! Don't mess with me!`);

Open Node.js command prompt and run the following code:

node console_example4.js
NODE.JS REPL
The Node.js or node come bundled with REPL environment.
Each part of the REPL environment has a specific work.
Read: It reads user's input; parse the input into JavaScript
data-structure and stores in memory.
Eval: It takes and evaluates the data structure.
Print: It prints the result.
Loop: It loops the above command until user press ctrl-c
twice.
NODE.JS NPM
Node Package Manager provides two main functionalities:

● It provides online repositories for node.js packages/modules which are


searchable on search.nodejs.org
● It also provides command line utility to install Node.js packages, do
version management and dependency management of Node.js
packages.

The npm comes bundled with Node.js installables in versions after that
v0.6.3. You can check the version by opening Node.js command prompt and
typing the following command:

npm version
NODE.JS CL OPTIONS
To see the version of the running Node:
Open Node.js command prompt and run command node -v or node --
version
For Help:
Use command node ?h or node --help
NODE.JS GLOBALS
Node.js global objects are global in nature and available in all modules. You don't need to
include these objects in your application; rather they can be used directly. These objects are
modules, functions, strings and object etc. Some of these objects aren't actually in the global
scope but in the module scope.
A list of Node.js global objects are given below:

● __dirname
● __filename
● Console
● Process
● Buffer
● setImmediate(callback[, arg][, ...])
● setInterval(callback, delay[, arg][, ...])
● setTimeout(callback, delay[, arg][, ...])
● clearImmediate(immediateObject)
● clearInterval(intervalObject)
NODE.JS OS
In this example, we are including some basic functions. Create a file named os_example1.js
having the following code:

File: os_example1.js

const os=require('os');

console.log("os.freemem(): \n",os.freemem());

console.log("os.homedir(): \n",os.homedir());

console.log("os.hostname(): \n",os.hostname());

console.log("os.endianness(): \n",os.endianness());

console.log("os.loadavg(): \n",os.loadavg());

console.log("os.platform(): \n",os.platform());

console.log("os.release(): \n",os.release());

console.log("os.tmpdir(): \n",os.tmpdir());

console.log("os.totalmem(): \n",os.totalmem());
Open Node.js command prompt and run the following code:

node os_example1.js
NODE.JS TIMERS
Node.js Timer functions are global functions. You don't need to use require() function in order to
use timer functions. Let's see the list of timer functions.

Set timer functions:

● setImmediate(): It is used to execute setImmediate.


● setInterval(): It is used to define a time interval.
● setTimeout(): ()- It is used to execute a one-time callback after delay milliseconds.

Clear timer functions:

● clearImmediate(immediateObject): It is used to stop an immediateObject, as created by


setImmediate
● clearInterval(intervalObject): It is used to stop an intervalObject, as created by
setInterval
● clearTimeout(timeoutObject): It prevents a timeoutObject, as created by setTimeout
NODE.JS ERRORS
The Node.js applications generally face four types of
errors:

● Standard JavaScript errors i.e. <EvalError>,


<SyntaxError>, <RangeError>, <ReferenceError>,
<TypeError>, <URIError> etc.
● System errors
● User-specified errors
● Assertion errors
Let's take an example to deploy standard JavaScript error - ReferenceError.

File: error_example1.js

// Throws with a ReferenceError because b is undefined

try {

const a = 1;

const c = a + b;

} catch (err) {

console.log(err);

}
NODE.JS DNS
The Node.js DNS module contains methods to get information of given
hostname. Let's see the list of commonly used DNS functions:

● dns.getServers()
● dns.setServers(servers)
● dns.lookup(hostname[, options], callback)
● dns.lookupService(address, port, callback)
● dns.resolve(hostname[, rrtype], callback)
● dns.resolve4(hostname, callback)
● dns.resolve6(hostname, callback)
● dns.resolveCname(hostname, callback)
NODE.JS DNS
Let's see the example of dns.lookup() function.
File: dns_example1.js

const dns = require('dns');

dns.lookup('www.boardinfinity.com',(err, addresses,
family) => {

console.log('addresses:', addresses);

console.log('family:',family);

});
NODE.JS NET
Node.js provides the ability to perform socket programming. We
can create chat application or communicate client and server
applications using socket programming in Node.js. The Node.js net
module contains functions for creating both servers and clients.

Node.js Net Example


In this example, we are using two command prompts:

● Node.js command prompt for server.


● Windows default command prompt for client.
NODE.JS CRYPTO
The Node.js Crypto module supports cryptography. It provides
cryptographic functionality that includes a set of wrappers for open SSL's
hash HMAC, cipher, decipher, sign and verify functions.

What is Hash
A hash is a fixed-length string of bits i.e. procedurally and deterministically
generated from some arbitrary block of source data.

What is HMAC
HMAC stands for Hash-based Message Authentication Code. It is a process
for applying a hash algorithm to both data and a secret key that results in a
single final hash.
NODE.JS TLS/SSL
TLS stands for Transport Layer Security. It is the successor to Secure
Sockets Layer (SSL). TLS along with SSL is used for cryptographic
protocols to secure communication over the web.

TLS uses public-key cryptography to encrypt messages. It encrypts


communication generally on the TCP layer.

What is public-key cryptography


In public-key cryptography, each client and each server has two keys:
public key and private key. Public key is shared with everyone and
private key is secured. To encrypt a message, a computer requires its
private key and the recipient?s public key. On the other hand, to decrypt
the message, the recipient requires its own
You have to use require('tls') to access this module.

Syntax:

var tls = require('tls');

The tls module uses OpenSSL to attain Transport Layer Security and Secure Socket
Layer. TLS/SSL is a public/private key infrastructure. Each client and each server
must have a private key.

A private key can be created like this:

openssl genrsa -out ryans-key.pem 1024

All severs and some clients need to have a certificate. Certificates are public keys
signed by a Certificate Authority or self-signed. To get certificate, you have to
create a "Certificate Signing Request" (CSR) file.
NODE.JS
DEBUGGER
Node.js provides a simple TCP based protocol and built-in debugging
client. For debugging your JavaScript file, you can use debug argument
followed by the js file name you want to debug.

Syntax:

node debug [script.js | -e "script" | <host>:<port>]

Example:

node debug main.js


If you make any error:

If you make any error in your js file source code or provide a wrong
path on the Node.js command prompt then you will get the
following result.
NODE.JS PROCESS
Let's see the simple process example to print architecture, pid, platform
and version of the process.
File: process_example1.js

console.log(`Process Architecture: ${process.arch}`);

console.log(`Process PID: ${process.pid}`);

console.log(`Process Platform: ${process.platform}`);

console.log(`Process Version: ${process.version}`);

Open Node.js command prompt and run the following code:

node process_example1.js
NODE.JS CHILD PROCESS
The Node.js child process module provides the ability to spawn child
processes in a similar manner to popen(3).

There are three major way to create child process:

● child_process.exec() method: This method runs a command in a


console and buffers the output.
● child_process.spawn() method: This method launches a new
process with a given command.
● child_process.fork() method: This method is a special case of
spawn() method to create child processes.
The child_process.exec() method runs a command in a console and buffers the output.

Syntax:

child_process.exec(command[, options], callback)

Parameters:

1) command: It specifies the command to run, with space-separated arguments.

2) options: It may contain one or more of the following options:

● cwd: It specifies the current working directory of the child process.


● env: It specifies environment key-value pairs.
● encoding: String (Default: 'utf8')
● shell: It specifies string Shell to execute the command with (Default: '/bin/sh' on UNIX,
'cmd.exe' on Windows, The shell should understand the -c switch on UNIX or /s /c on
Windows. On Windows, command line parsing should be compatible with cmd.exe.)
NODE.JS BUFFERS
Node.js provides Buffer class to store raw data similar to an array of integers but corresponds
to a raw memory allocation outside the V8 heap. Buffer class is used because pure JavaScript
is not nice to binary data. So, when dealing with TCP streams or the file system, it's necessary
to handle octet streams.

Buffer class is a global class. It can be accessed in application without importing buffer
module.

Node.js Creating Buffers


There are many ways to construct a Node buffer. Following are the three mostly used
methods:

1. Create an uninitiated buffer: Following is the syntax of creating an uninitiated buffer


of 10 octets:

var buf = new Buffer(10);


Create a buffer from array: Following is the syntax to create a Buffer from
a given array:

var buf = new Buffer([10, 20, 30, 40, 50]);

Create a buffer from string: Following is the syntax to create a Buffer from
a given string and optionally encoding type:

var buf = new Buffer("Simply Easy Learning", "utf-8");


NODE.JS STREAMS
Streams are the objects that facilitate you to read data from a
source and write data to a destination. There are four types of
streams in Node.js:

● Readable: This stream is used for read operations.


● Writable: This stream is used for write operations.
● Duplex: This stream can be used for both read and write
operations.
● Transform: It is type of duplex stream where the output is
computed according to input.
Each type of stream is an Event emitter instance and throws several
events at different times. Following are some commonly used events:

● Data:This event is fired when there is data available to read.


● End:This event is fired when there is no more data available to
read.
● Error: This event is fired when there is any error receiving or
writing data.
● Finish:This event is fired when all data has been flushed to
underlying system.
NODE.JS FILE SYSTEM
In Node.js, file I/O is provided by simple wrappers around standard POSIX
functions. Node File System (fs) module can be imported using following syntax:

Syntax:

var fs = require("fs")

Node.js FS Reading File


Every method in fs module has synchronous and asynchronous forms.

Asynchronous methods take a last parameter as completion function callback.


Asynchronous method is preferred over synchronous method because it never
blocks the program execution where as the synchronous method blocks.
var fs = require("fs");

// Asynchronous read

fs.readFile('input.txt', function (err, data) {

if (err) {

return console.error(err);

console.log("Asynchronous read: " + data.toString());

});

// Synchronous read

var data = fs.readFileSync('input.txt');

console.log("Synchronous read: " + data.toString());

console.log("Program Ended");
Node.js Open a file
Syntax:

Following is the syntax of the method to open a file in asynchronous mode:

1. fs.open(path, flags[, mode], callback)

Parameter explanation:

Following is the description of parameters used in the above syntax:

path: This is a string having filename including path.

flags: Flag specifies the behavior of the file to be opened. All possible values have been
mentioned below.

mode: This sets the file mode (permission and sticky bits), but only if the file was created.
It defaults to 0666, readable and writable.

callback: This is the callback function which gets two arguments (err, fd).
Create a JavaScript file named "main.js" having the following code to open a file input.txt for
reading and writing.

File: main.js

var fs = require("fs");

// Asynchronous - Opening File

console.log("Going to open file!");

fs.open('input.txt', 'r+', function(err, fd) {

if (err) {

return console.error(err);

console.log("File opened successfully!");

});
Open Node.js command prompt and run the main.js:

node main.js
NODE.JS PATH
The Node.js path module is used to handle and transform files paths.
This module can be imported by using the following syntax:

Syntax:

var path = require ("path")

Node.js Path Example


File: path_example.js
var path = require("path");

// Normalization

console.log('normalization : ' +
path.normalize('/sssit/javatpoint//node/newfolder/tab/..'));

// Join

console.log('joint path : ' + path.join('/sssit', 'javatpoint',


'node/newfolder', 'tab', '..'));

// Resolve

console.log('resolve : ' + path.resolve('path_example.js'));

// Extension

console.log('ext name: ' + path.extname('path_example.js'));


NODE.JS STRING DECODER
The Node.js StringDecoder is used to decode buffer into string. It is
similar to buffer.toString() but provides extra support to UTF.

You need to use require('string_decoder') to use StringDecoder


module.

const StringDecoder =
require('string_decoder').StringDecoder;

Node.js StringDecoder Methods


StringDecoder class has two methods only.
Let's see a simple example of Node.js StringDecoder.

File: stringdecoder_example1.js

const StringDecoder = require('string_decoder').StringDecoder;

const decoder = new StringDecoder('utf8');

const buf1 = new Buffer('this is a test');

console.log(decoder.write(buf1));//prints: this is a test

const buf2 = new Buffer('7468697320697320612074c3a97374', 'hex');

console.log(decoder.write(buf2));//prints: this is a test

const buf3 = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);

console.log(decoder.write(buf3));//prints: buffer
NODE.JS QUERY STRING
The Node.js Query String provides methods to deal with query string. It
can be used to convert query string into JSON object and vice-versa.

To use query string module, you need to use require('querystring').

Node.js Query String Methods


The Node.js Query String utility has four methods.
Let's see a simple example of Node.js Query String parse() method.
File: query-string-example1.js

querystring = require('querystring');

const
obj1=querystring.parse('name=sonoo&company=javatpoint');

console.log(obj1);
NODE.JS ZLIB
The Node.js Zlib module is used to provide compression and
decompression (zip and unzip) functionalities. It is
implemented using Gzip and deflate/inflate.
The zlib module can be accessed using:

const zlib = require('zlib');


Compressing and decompressing a file can be done by piping
the source stream data into a destination stream through zlib
stream.
Let's see a simple example of Node.js ZLIB module to compress a file
"input.txt" into "input.txt.gz".
File: zlib_example1.js

const zlib = require('zlib');

const gzip = zlib.createGzip();

const fs = require('fs');

const inp = fs.createReadStream('input.txt');

const out = fs.createWriteStream('input.txt.gz');

inp.pipe(gzip).pipe(out);
NODE.JS ASSERTION
The Node.js Assert is the most elementary way to write
tests. It provides no feedback when running your test unless
one fails. The assert module provides a simple set of
assertion tests that can be used to test invariants. The
module is intended for internal use by Node.js, but can be
used in application code via require ('assert').
However assert is not a testing framework and cannot be
used as general purpose assertion library.
Let's see a simple example of Node.js Assert.

File: assert_example1.js

var assert = require('assert');

function add (a, b) {

return a + b;

var expected = add(1,2);

assert( expected === 3, 'one plus two is three');


NODE.JS V8
V8 is an open source JavaScript engine developed by the Chromium project
for the Google Chrome web browser. It is written in C++. Now a days, it is
used in many projects such as Couchbase, MongoDB and Node.js.

V8 in Node.js
The Node.js V8 module represents interfaces and event specific to the
version of V8. It provides methods to get information about heap memory
through v8.getHeapStatistics() and v8.getHeapSpaceStatistics()
methods.
To use this module, you need to use require('v8').

const v8 = require('v8');
The v8.getHeapStatistics() method returns statistics about heap such as
total heap size, used heap size, heap size limit, total available size etc.
File: v8-example1.js

const v8 = require('v8');

console.log(v8.getHeapStatistics());
NODE.JS CALLBACKS
• Callback is an asynchronous equivalent for a function. It is called
at the completion of each task.
• In Node.js, callbacks are generally used. All APIs of Node are
written in a way to supports callbacks.
• For example: when a function start reading file, it returns the
control to execution environment immediately so that the next
instruction can be executed.
• In Node.js, once file I/O is complete, it will call the callback
function. So there is no blocking or wait for File I/O.
• This makes Node.js highly scalable, as it can process high
number of request without waiting for any function to return
result.
NODE.JS EVENTS
1. Create a text file named input.txt having the following content:
Javatpoint is an online platform providing self learning tutorials on
different technologies, in a very simple language.
2. Create a JavaScript file named main.js having the following code:
var fs = require("fs");
var data = fs.readFileSync('input.txt');
console.log(data.toString());
console.log("Program Ended");
3. Open the Node.js command prompt and execute the following code.
node main.js
NODE.JS
EVENTS
In Node.js applications, Events and Callbacks concepts are used to provide
concurrency. As Node.js applications are single threaded and every API of
Node js are asynchronous. So it uses async function to maintain the
concurrency. Node uses observer pattern. Node thread keeps an event loop
and after the completion of any task, it fires the corresponding event which
signals the event listener function to get executed.

Event Driven Programming


Node.js uses event driven programming. It means as soon as Node starts its
server, it simply initiates its variables, declares functions and then simply
waits for event to occur. It is the one of the reason why Node.js is pretty fast
compared to other similar technologies.
NODE.JS PUNNY CODE
Punycode is an encoding syntax which is used to convert Unicode (UTF-8) string of
characters to basic ASCII string of characters. Since host names only understand
ASCII characters so Punycode is used. It is used as an internationalized domain
name (IDN or IDNA). Let's understand it with an example:

Assume if you search for mañana.com in your browser so your browser (which is
IDNA enabled) first convert this to punycode xn--maana-pta.com because the
character ñ is not allowed in regular domain name. It is not supported in older
versions.

Punycode.js is bundled with Node.js v0.6.2 and later versions. If you want to use it
with other Node.js versions then use npm to install punycode module first. You have
to use require ('punycode') to access it.

Syntax:

punycode = require('punycode');
NODE.JS TTY
The Node.js TTY module contains tty.ReadStream and tty.WriteStream
classes. In most cases, there is no need to use this module directly.

You have to use require ('tty') to access this module.

Syntax:

var tty = require('tty');

When Node.js discovers that it is being run inside a TTY context, then:

● process.stdin will be a tty.ReadStream instance


● process.stdout will be a tty.WriteStream instance
To check that if Node.js is running in a TTY context, use the
following command:

node -p -e "Boolean(process.stdout.isTTY)"
NODE.JS WEB MODULES
Web Server is a software program that handles HTTP requests sent
by HTTP clients like web browsers, and returns web pages in
response to the clients. Web servers usually respond with html
documents along with images, style sheets and scripts.
Most of the web server support server side scripts using scripting
language or redirect to application server which perform the specific
task of getting data from database, perform complex logic etc. and
then sends a result to the HTTP client through the Web server.
Apache web server is one of the most commonly used web server. It
is an open source project.
● Client Layer: The Client layer contains web browsers, mobile
browsers or applications which can make HTTP request to the
web server.
● Server Layer: The Server layer contains Web server which can
intercepts the request made by clients and pass them the
response.
● Business Layer: The business layer contains application server
which is utilized by web server to do required processing. This
layer interacts with data layer via database or some external
programs.
WEB MODULES
NEST JS

NestJS is quite a popular and cumulative JavaScript framework


functioning under the hood of Node.js and is used to construct
scalable, reliable, and efficient server-side applications. The
framework is channeled with the Node.js environment and supports
TypeScript fully. It also can be scaled to make use of Express.js under
the influence of Node.js. Since NestJS is a full TypeScript supported
framework, it can enable developers like you to code purely in
JavaScript and would let you combine the concepts of Object-Oriented
Programming(OOP), Functional Reactive Programming(FRP), and
purely Functional Programming(FP).
Node.JS
MySQL
MySQL CREATE CONNECTION

Install MySQL on your computer.


You can download it from here https://www.mysql.com/downloads/.

Once the MySQL is installed and running, you can access it by using Node.js.

Install MySQL Driver


You have to install MySQL driver to access a MySQL database with Node.js.
Download MySQl module from npm.

To download and install the "mysql" module, open the Command Terminal and
execute the following:

npm install mysql


Create Connection
Create a folder named "DBexample". In that folder create a js file named "connection.js" having the following code:

var mysql = require('mysql');

var con = mysql.createConnection({

host: "localhost",

user: "root",

password: "12345"

});

con.connect(function(err) {

if (err) throw err;

console.log("Connected!");

});
Now open the command terminal and use the following
command:
Node connection.js
MySQL CREATE DATABASE
CREATE DATABASE statement is used to create a database in
MySQL.
Example
For creating a database named "Board Infinity".
Create a js file named boardinfinity.js having the following
data in DBexample folder.
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
con.query("CREATE DATABASE Board Infinity", function (err,
result) {
if (err) throw err;
console.log("Database created");
});
});
MySQL CREATE TABLE
CREATE TABLE command is used to create a table in
MySQL. You must make it sure that you define the name of
the database when you create the connection.
Example
For creating a table named "employees".
Create a js file named employees.js having the following
data in DBexample folder.
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345",
database: "Board Infinity"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "CREATE TABLE employees (id INT, name VARCHAR(255), age
INT(3), city VARCHAR(255))";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("Table created");
});
});
Now open command terminal and run the following
command:

Node employees.js
MySQL INSERT RECORD
INSERT INTO statement is used to insert records in
MySQL.
Example
Insert Single Record:
Insert records in "employees" table.
Create a js file named "insert" in DBexample folder and
put the following data into it:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345",
database: "Board Infinity"
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
var sql = "INSERT INTO employees (id, name, age, city) VALUES
('1', 'Ajeet Kumar', '27', 'Allahabad')";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("1 record inserted");
});
Now open command terminal and run the following
command:

Node insert.js
MySQL UPDATE RECORD
The UPDATE command is used to update records
in the table.
Example
Update city in "employees" table where id is 1.
Create a js file named "update" in DBexample
folder and put the following data into it:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345",
database: "Board Infinity"
});
con.connect(function(err) {
if (err) throw err;
var sql = "UPDATE employees SET city = 'Delhi' WHERE city =
'Allahabad'";
con.query(sql, function (err, result) {
if (err) throw err;
console.log(result.affectedRows + " record(s) updated");
});
});
Now open command terminal and run the following
command:

Node update.js
MySQL DELETE RECORD
The DELETE FROM command is used to delete
records from the table.
Example
Delete employee from the table employees where
city is Delhi.
Create a js file named "delete" in DBexample folder
and put the following data into it:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345",
database: "Board Infinity"
});
con.connect(function(err) {
if (err) throw err;
var sql = "DELETE FROM employees WHERE city = 'Delhi'";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("Number of records deleted: " + result.affectedRows);

});
});
Now open command terminal and run the following
command:

Node delete.js
MySQL SELECT RECORD
Example
Retrieve all data from the table "employees".
Create a js file named select.js having the following data in DBexample folder.
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345",
database: "Board Infinity"
});
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM employees", function (err, result) {
if (err) throw err;
console.log(result);
});
});
Now open command terminal and run the
following command:

Node select.js
MySQL SELECT UNIQUE

(WHERE Clause)
Retrieve a unique data from the table "employees".
Create a js file named select where.js having the
following data in DB example folder.
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345",
database: "Board Infinity"
});
con.connect(function(err) {
if (err) throw err;
con.query("SELECT * FROM employees WHERE id = '1'", function
(err, result) {
if (err) throw err;
console.log(result);
});
});
Now open command terminal and run the following
command:

Node select where.js


MySQL DROP TABLE
The DROP TABLE command is used to delete or
drop a table.
Let's drop a table named employee 2.
Create a js file named "delete" in DB example
folder and put the following data into it:
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "12345",

database: "Board Infinity"


});
con.connect(function(err) {
if (err) throw err;
var sql = "DROP TABLE employee2";
con.query(sql, function (err, result) {
if (err) throw err;
console.log("Table deleted");
});
});
Now open command terminal and run the following
command:

Node drop.js
Node.JS
MongoDB
CREATE CONNECTION
MongoDb is a NoSQL database. It can be used with
Node.js as a database to insert and retrieve data.

Download MongoDB
Open the Linux Command Terminal and execute the
following command:

apt-get install mongodb


It will download the latest MongoDB according to your
system requirement.
Install MongoDB
After the complete download, use the following command to install
MogoDB.

npm install mongodb --save

Use the following command to start MongoDb services:

service mongodb start


CREATE DATABASE
To create a database in MongoDB, First create a MongoClient object
and specify a connection URL with the correct ip address and the
name of the database which you want to create.

Note: MongoDB will automatically create the database if it does


not exist, and make a connection to it.
Example

Create a folder named "MongoDatabase" as a database. Suppose you


create it on Desktop. Create a js file named "createdatabase.js" within
that folder and having the following code:
var MongoClient = require('mongodb').MongoClient;

var url =
"mongodb://localhost:27017/MongoDatabase";

MongoClient.connect(url, function(err, db) {

if (err) throw err;

console.log("Database created!");

db.close();

});
Now open the command terminal and set the path
where Mongo Database exists. Now execute the
following command:

Node createdatabase.js
CREATE COLLECTION
MongoDB is a NoSQL database so data is stored in
collection instead of table. createCollection method is
used to create a collection in MongoDB.
Example
Create a collection named "employees".
Create a js file named "employees.js", having the
following data:
var MongoClient = require('mongodb').MongoClient;

var url = "mongodb://localhost:27017/ MongoDatabase";

MongoClient.connect(url, function(err, db) {

if (err) throw err;

db.createCollection("employees", function(err, res) {

if (err) throw err;

console.log("Collection is created!");

db.close();

});

});
Open the command terminal and run the following
command:

Node employees.js
MongoDB INSERT
RECORD
The insertOne method is used to insert record in Mongo DB
collection. The first argument of the insertOne method is an
object which contains the name and value of each field in the
record you want to insert.
Example
(Insert Single record)
Insert a record in "employees" collection.
Create a js file named "insert.js", having the following code:
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/ MongoDatabase";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var myobj = [
{ name: "Mahesh Sharma", age: "25", address: "Ghaziabad"},
{ name: "Tom Moody", age: "31", address: "CA"},
{ name: "Zahira Wasim", age: "19", address: "Islamabad"},
{ name: "Juck Ross", age: "45", address: "London"}
];
db.collection("customers").insert(myobj, function(err, res) {
if (err) throw err;
console.log("Number of records inserted: " +
res.insertedCount);
db.close();
});
});
Open the command terminal and run the following
command:

Node insert all.js


MongoDB SELECT
The findOne() method is used to select a single data
from a collection in MongoDB. This method returns the
first record of the collection.
Example
(Select Single Record)
Select the first record from the employees collection.
Create a js file named "select.js", having the following
code:
var http = require('http');

var MongoClient = require('mongodb').MongoClient;

var url = "mongodb://localhost:27017/MongoDatabase";

MongoClient.connect(url, function(err, db) {

if (err) throw err;

db.collection("employees").findOne({}, function(err, result) {

if (err) throw err;

console.log(result.name);

db.close();

});

});
Open the command terminal and run the following
command:

Node select.js
MongoDB QUERY
The find() method is also used to filter the result on a
specific parameter. You can filter the result by using a
query object.
Example
Filter the records to retrieve the specific employee whose
address is "Delhi".
Create a js file named "query1.js", having the following
code:
var http = require('http');

var MongoClient = require('mongodb').MongoClient;


var url = "mongodb://localhost:27017/MongoDatabase";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var query = { address: "Delhi" };
db.collection("employees").find(query).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
Open the command terminal and run the following
command:

Node query1.js
MongoDB SORTING
In MongoDB, the sort() method is used for sorting the
results in ascending or descending order. The sort() method
uses a parameter to define the object sorting order.

Value used for sorting in ascending order:

{ name: 1 }

Value used for sorting in descending order:

{ name: -1 }
Sort in Ascending Order
Example

Sort the records in ascending order by the name.

Create a js file named "sortasc.js", having the following code:

var http = require('http');


var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/ MongoDatabase";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var mysort = { name: 1 };
db.collection("employees").find().sort(mysort).toArray(function(err, result) {

if (err) throw err;


console.log(result);
db.close();
});
});
Open the command terminal and run the following
command:

Node sortasc.js
MongoDB REMOVE
In MongoDB, you can delete records or documents by
using the remove() method. The first parameter of the
remove() method is a query object which specifies the
document to delete.
Example
Remove the record of employee whose address is
Ghaziabad.
Create a js file named "remove.js", having the following
code:
var http = require('http');

var MongoClient = require('mongodb').MongoClient;

var url = "mongodb://localhost:27017/ MongoDatabase";

MongoClient.connect(url, function(err, db) {

if (err) throw err;

var myquery = { address: 'Ghaziabad' };

db.collection("employees").remove(myquery, function(err, obj) {

if (err) throw err;

console.log(obj.result.n + " record(s) deleted");

db.close();

});

});
Open the command terminal and run the following
command:

Node remove.js
Express JS
EXPRESS JS INTRODUCTION
Express is a fast, assertive, essential and moderate web framework of
Node.js. You can assume express as a layer built on the top of the Node.js
that helps manage a server and routes. It provides a robust set of features
to develop web and mobile applications.
Let's see some of the core features of Express framework:
● It can be used to design single-page, multi-page and hybrid web
applications.
● It allows to setup middlewares to respond to HTTP Requests.
● It defines a routing table which is used to perform different actions
based on HTTP method and URL.
● It allows to dynamically render HTML Pages based on passing
arguments to templates.
EXPRESS JS FIRST
EXAMPLE

var express = require('express');


var app = express();
app.get('/', function (req, res) {
res.send('Welcome to JavaTpoint!');
});
var server = app.listen(8000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host,
port);
});
EXPRESS JS
INSTALLATION
Firstly, you have to install the express framework globally to create web application
using Node terminal. Use the following command to install express framework globally.

npm install -g express


Installing Express
Use the following command to install express:

npm install express --save


EXPRESS JS REQUEST
Express.js Request and Response objects are the parameters of the
callback function which is used in Express applications.

The express.js request object represents the HTTP request and has
properties for the request query string, parameters, body, HTTP
headers, and so on.

Syntax:
app.get('/', function (req, res) {
// --
})
Request Object Methods
Following is a list of some generally used request object methods:

req.accepts (types)
This method is used to check whether the specified content types are
acceptable, based on the request's Accept HTTP header field.

Examples:

req.accepts('html');

//=>?html?

req.accepts('text/html');

// => ?text/html?
req.get(field)
This method returns the specified HTTP request header field.
Examples:

req.get('Content-Type');

// => "text/plain"

req.get('content-type');

// => "text/plain"

req.get('Something');

// => undefined
req.is(type)
This method returns true if the incoming request's "Content-Type" HTTP header
field matches the MIME type specified by the type parameter.

Examples:

// With Content-Type: text/html; charset=utf-8

req.is('html');

req.is('text/html');

req.is('text/*');

// => true
req.param(name [, defaultValue])
This method is used to fetch the value of param name when present.

Examples:

// ?name=sasha
req.param('name')
// => "sasha"
// POST name=sasha
req.param('name')
// => "sasha"
// /user/sasha for /user/:name
req.param('name')
// => "sasha"
EXPRESS JS
RESPONSE
The Response object (res) specifies the HTTP response which is sent by an
Express app when it gets an HTTP request.

What it does

● It sends response back to the client browser.


● It facilitates you to put new cookies value and that will write to
the client browser (under cross domain rule).
● Once you res.send() or res.redirect() or res.render(), you cannot
do it again, otherwise, there will be uncaught error.
Response Object Methods
Following are some methods:

Response Append method


Syntax:

res.append(field [, value])

This method appends the specified value to the HTTP response header field. That means if the
specified value is not appropriate then this method redress that.

Examples:

res.append('Link', ['<http://localhost/>', '<http://localhost:3000/>']);

res.append('Warning', '199 Miscellaneous warning');


Response Attachment method
Syntax:

res.attachment([filename])

This method facilitates you to send a file as an attachment in the HTTP response.

Examples:

res.attachment('path/to/js_pic.png');

Response Cookie method


Syntax:

res.cookie(name, value [, options])


Response ClearCookie method
Syntax:

res.clearCookie(name [, options])

As the name specifies, the clearCookie method is used to clear the cookie
specified by name.

Examples:

To set a cookie

res.cookie('name', 'Aryan', { path: '/admin' });

To clear a cookie:

res.clearCookie('name', { path: '/admin' });


Response Download method
Syntax:

res.download(path [, filename] [, fn])

This method transfers the file at path as an "attachment" and enforces the browser
to prompt user for download.

Example:

res.download('/report-12345.pdf');

Response End method


Syntax:

res.end([data] [, encoding])
Response Format method
Syntax:

res.format(object)

This method performs content negotiation on the Accept HTTP header on


the request object, when present.

Example:
res.format({
'text/plain': function(){
res.send('hey');
},
'text/html': function(){
res.send('
hey');
},
'application/json': function(){
res.send({ message: 'hey' });
},
'default': function() {
// log the request and respond with 406
res.status(406).send('Not Acceptable');
}
});
Response JSONP method
Syntax:

res.jsonp([body])

This method returns response in JSON format with JSONP support.

Examples:

res.jsonp(null)

res.jsonp({ name: 'ajeet' })

Response Links method


Syntax:

res.links(links)

This method populates the response?s Link HTTP header field by joining the links provided as properties of the
parameter.
Response Location method
Syntax:

res.location(path)
This method is used to set the response location HTTP header
field based on the specified path parameter.
Examples:

res.location('http://xyz.com');
Response Redirect method
Syntax:

res.redirect([status,] path)

This method redirects to the URL derived from the specified path, with specified HTTP status

Examples:

res.redirect('http://example.com');

Response Render method


Syntax:

res.render(view [, locals] [, callback])

This method renders a view and sends the rendered HTML string to the client.
Response Send method
Syntax:

res.send([body])

This method is used to send HTTP response.

Examples:

res.send(new Buffer('whoop'));

res.send({ some: 'json' });

res.send('

.....some html

');
Response sendFile method
Syntax:

res.sendFile(path [, options] [, fn])

This method is used to transfer the file at the given path. It sets the
Content-Type response HTTP header field based on the file name
extension.

Examples:

res.sendFile(fileName, options, function (err) {

// ...

});
Response Set method
Syntax:

res.set(field [, value])

This method is used to set the response of HTTP header field to value.

Examples:

res.set('Content-Type', 'text/plain');

res.set({

'Content-Type': 'text/plain',

'Content-Length': '123',

})
Response Status method
Syntax:

res.status(code)
This method sets an HTTP status for the response.
Examples:

res.status(403).end();

res.status(400).send('Bad Request');
Response Type method
Syntax:

res.type(type)

This method sets the content-type HTTP header to the MIME type.

Examples:

res.type('.html'); // => 'text/html'

res.type('html'); // => 'text/html'

res.type('json'); // => 'application/json'

res.type('application/json'); // => 'application/json'

res.type('png'); // => image/png:


EXPRESS JS GET
GET and POST both are two common HTTP requests used for building REST API's.
GET requests are used to send only limited amount of data because data is sent into
header while POST requests are used to send large amount of data because data is
sent in the body.

Express.js facilitates you to handle GET and POST requests using the instance of
express.

Express.js GET Method Example 1


Fetch data in JSON format:

Get method facilitates you to send only limited amount of data because data is sent
in the header. It is not secure because data is visible in URL bar.

Let's take an example to demonstrate GET method.


File: index.html
<html>
<body>
<form action="http://127.0.0.1:8081/process_get"
method="GET">
First Name: <input type="text" name="first_name">
<br>
Last Name: <input type="text" name="last_name">
<input type="submit" value="Submit">
</form>
</body>
</html>
File: index.html
<html>
<body>
<form action="http://127.0.0.1:8081/process_get"
method="GET">
First Name: <input type="text" name="first_name">
<br>
Last Name: <input type="text" name="last_name">
<input type="submit" value="Submit">
</form>
</body>
</html>
Open the page index.html and fill the entries:
Now, you get the data in JSON format.
EXPRESS JS POST
GET and POST both are two common HTTP requests used for building
REST API's. POST requests are used to send large amount of data.

Express.js facilitates you to handle GET and POST requests using the
instance of express.

Express.js POST Method


Post method facilitates you to send large amount of data because data is
send in the body. Post method is secure because data is not visible in URL
bar but it is not used as popularly as GET method. On the other hand GET
method is more efficient and used more than POST.

Let's take an example to demonstrate POST method.


Example1:

Fetch data in JSON format

File: Index.html

<html>

<body>

<form action="http://127.0.0.1:8000/process_post" method="POST">

First Name: <input type="text" name="first_name"> <br>

Last Name: <input type="text" name="last_name">

<input type="submit" value="Submit">

</form>

</body>

</html>
EXPRESS JS ROUTING
Routing is made from the word route. It is used to
determine the specific behavior of an application. It
specifies how an application responds to a client
request to a particular route, URI or path and a specific
HTTP request method (GET, POST, etc.). It can handle
different types of HTTP requests.
Let's take an example to see basic routing.
var express = require('express');

var app = express();

app.get('/', function (req, res) {

console.log("Got a GET request for the homepage");

res.send('Welcome to JavaTpoint!');

})

app.post('/', function (req, res) {

console.log("Got a POST request for the homepage");

res.send('I am Impossible! ');

})
app.delete('/del_student', function (req, res) {

console.log("Got a DELETE request for


/del_student");

res.send('I am Deleted!');

})

app.get('/enrolled_student', function (req, res) {

console.log("Got a GET request for


/enrolled_student");

res.send('I am an enrolled student.');

})
// This responds a GET request for abcd, abxcd, ab123cd, and so
on

app.get('/ab*cd', function(req, res) {

console.log("Got a GET request for /ab*cd");

res.send('Pattern Matched.');

})

var server = app.listen(8000, function () {

var host = server.address().address

var port = server.address().port

console.log("Example app listening at http://%s:%s", host, port)

})
EXPRESS JS COOKIES
Cookies are small piece of information i.e. sent from a website and
stored in user's web browser when user browses that website. Every
time the user loads that website back, the browser sends that stored
data back to website or server, to recognize user.
Install cookie
You have to acquire cookie abilities in Express.js. So, install
cookie-parser middleware through npm by using the following
command:
Import cookie-parser into your app.
var express = require('express');

var cookieParser = require('cookie-


parser');

var app = express();

app.use(cookieParser());
Define a route:
Cookie-parser parses Cookie header and populate req.cookies with an object keyed by
the cookie names.

Let's define a new route in your express app like set a new cookie:

app.get('/cookie',function(req, res){

res.cookie('cookie_name' , 'cookie_value').send('Cookie is set');

});

app.get('/', function(req, res) {

console.log("Cookies : ", req.cookies);

});

Browser sends back that cookie to the server, every time when it requests that website.
EXPRESS JS FILE
UPLOAD
In Express.js, file upload is slightly difficult because of its
asynchronous nature and networking approach.
It can be done by using middleware to handle multipart/form
data. There are many middleware that can be used like
multer, connect, body-parser etc.
Let's take an example to demonstrate file upload in Node.js.
Here, we are using the middleware 'multer'.
Create a folder "jtp file upload" having the following files:
uploads: It is an empty folder i.e. created to store the uploaded images.

package: It is JSON file, having the following data:


File: package.json

{
"name": "file_upload",
"version": "0.0.1",
"dependencies": {
"express": "4.13.3",
"multer": "1.1.0"
},
"devDependencies": {
"should": "~7.1.0",
"mocha": "~2.3.3",
"supertest": "~1.1.0"
}
}
To install the package.json, execute the following
code:

npm install
EXPRESS JS
MIDDLEWARE
Express.js Middleware are different types of functions that are
invoked by the Express.js routing layer before the final request
handler.
As the name specified, Middleware appears in the middle
between an initial request and final intended route.
In stack, middleware functions are always invoked in the order in
which they are added.
Middleware is commonly used to perform tasks like body parsing
for URL-encoded or JSON requests, cookie parsing for basic
cookie handling, or even building JavaScript modules on the fly.
What is a Middleware function
Middleware functions are the functions that access to
the request and response object (req, res) in request-
response cycle.
A middleware function can perform the following tasks:
● It can execute any code.
● It can make changes to the request and the
response objects.
● It can end the request-response cycle.
● It can call the next middleware function in the stack.
Express.js Middleware
Following is a list of possibly used middleware in Express.js app:

● Application-level middleware
● Router-level middleware
● Error-handling middleware
● Built-in middleware
● Third-party middleware

Let's take an example to understand what middleware is and how it


works.

Let's take the most basic Express.js app:


var express = require('express');

var app = express();

app.get('/', function(req, res) {

res.send('Welcome to JavaTpoint!');

});

app.get('/help', function(req, res) {

res.send('How can I help You?');

});
var server = app.listen(8000, function () {

var host = server.address().address

var port = server.address().port

console.log("Example app listening at


http://%s:%s", host, port)

})
You see that server is listening.
Now, you can see the result generated by server on the local
host http://127.0.0.1:8000
EXPRESS JS SCAFFOLDING
Scaffolding is a technique that is supported by some MVC frameworks.

It is mainly supported by the following frameworks:

Ruby on Rails,OutSystems Platform, Express Framework, Play framework,


Django, MonoRail, Brail, Symfony, Laravel, CodeIgniter, Yii, CakePHP,
Phalcon PHP, Model-Glue, PRADO, Grails, Catalyst, Seam Framework,
Spring Roo, ASP.NET etc.

Scaffolding facilitates the programmers to specify how the application data


may be used. This specification is used by the frameworks with predefined
code templates, to generate the final code that the application can use for
CRUD operations (create, read, update and delete database entries)
Install scaffold
Execute the following command to install scaffold.

npm install express-scaffold


After this step, execute the following command to install express
generator:

npm install -g express-generator


What is a template engine
A template engine facilitates you to use static template files in your applications.
At runtime, it replaces variables in a template file with actual values, and
transforms the template into an HTML file sent to the client. So this approach is
preferred to design HTML pages easily.

Following is a list of some popular template engines that work with Express.js:

● Pug (formerly known as jade)


● mustache
● dust
● atpl
● eco
● ect
● ejs
Using template engines with Express
Template engine makes you able to use static template files in
your application. To render template files you have to set the
following application setting properties:

● Views: It specifies a directory where the template files are


located.
● For example: app.set('views', './views').view engine: It
specifies the template engine that you use. For example, to
use the Pug template engine: app.set('view engine', 'pug').
Summary
● Provides an overview of Backend Development Technology using
NodeJS
● Enhance the knowledge on backend stack like Node, Express,
Databases
● Provides an ample knowledge on different topics like -
○ Node JS
○ Node JS with MySQL
○ Node JS with MongoDB
○ Express JS
Reference Materials

● https://nodejs.dev/learn/run-nodejs-scripts-from-the-command-line
● https://www.w3schools.com/nodejs/nodejs_mysql.asp
● https://docs.mongodb.com/drivers/node/current/
● https://www.w3schools.com/nodejs/nodejs_mongodb.asp
● https://www.npmjs.com/package/express
● https://www.tutorialspoint.com/expressjs/index.htm
ANY QUESTION ???
THANK YOU !!!

You might also like