SlideShare a Scribd company logo
2
Most read
Stack RESTful API Tutorial - Using MongoDB, Express,
Angular JS, and Node JS Together
Before starting on these let us discuss about the platforms terms.
What is NodeJs?
Node.js is a server side platform built on Google Chrome's JavaScript
Engine (V8 Engine). Node.js was developed by Ryan Dahl in 2009 and its
latest version is v0.10.36. The definition of Node.js as supplied by its official
documentation is as follows −
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 is an open source, cross-platform runtime environment for
developing server-side and networking applications. Node.js applications
are written in JavaScript, and can be run within the Node.js runtime on OS
X, Microsoft Windows, and Linux.
Node.js also provides a rich library of various JavaScript modules which
simplifies the development of web applications using Node.js to a great
extent.
Node.js = Runtime Environment + JavaScript Library
Features of Node.js
Following are some of the important features that make Node.js the first
choice of software architects.
∑ Asynchronous and Event Driven All APIs of Node.js library are asynchronous
that is, non-blocking. It essentially means 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.
∑ Very Fast Being built on Google Chrome's V8 JavaScript Engine, Node.js library
is very fast in code execution.
∑ Single Threaded but Highly Scalable - Node.js uses a single threaded model
with event looping. Event mechanism helps the server to respond in a non-
blocking way and makes the server highly scalable as opposed to traditional
servers which create limited threads to handle requests. Node.js uses a single
threaded program and the same program can provide service to a much larger
number of requests than traditional servers like Apache HTTP Server.
∑ No Buffering - Node.js applications never buffer any data. These applications
simply output the data in chunks.
∑ License - Node.js is released under the MIT license.
Who Uses Node.js?
Following is the link on github wiki containing an exhaustive list of projects,
application and companies which are using Node.js. This list includes eBay,
General Electric, GoDaddy, Microsoft, PayPal, Uber, Wikipins, Yahoo!, and
Yammer to name a few.
∑ Projects, Applications, and Companies Using Node
Concepts
The following diagram depicts some important parts of Node.js which we
will discuss in detail in the subsequent chapters.
Where to Use Node.js?
Following are the areas where Node.js is proving itself as a perfect
technology partner.
∑ I/O bound Applications
∑ Data Streaming Applications
∑ Data Intensive Real time Applications (DIRT)
∑ JSON APIs based Applications
∑ Single Page Applications
Where Not to Use Node.js?
It is not advisable to use Node.js for CPU intensive applications.
What is MongoDb?
MongoDb is a Open Source database written in C++.
Drivers and client libraries are typically written in their respective languages,
although some drivers use C extensions for better performance.
If the load increases, by adding more nodes (such as a computer), the
performance can be retained.
It can be used to store data for very high performance applications (for example
Foursquare is using it in production).
MongoDB does not support SQL It supports a rich, ad-hoc query language of its
own.
MongoDb stores data as documents. So it is a document oriented database.
FirstName="Arun", Address="St. Xavier's Road", Spouse=[{Name:"Kiran"}],
Children=[{Name:"Rihit", Age:8}].
FirstName="Sameer",Address="8 Gandhi Road".
Notice there are two different documents (separated by "."). Storing data in this
fashion is called asdocument oriented database. MongoDb is a document
oriented database.
Key Features
Since MongoDb offers a Document oriented storage, It is simple and easily
programmable.
∑ You can set an index on any attribute of a MongoDb record (as
FirstName="Sameer",Address="8 Gandhi Road"), with respect to which, a record can be sort
quickly and ordered.
∑ You can set mirror across local as well as wide area networks, which makes it easily scalable.
∑ If load increases (more storage space, more processing power), it can be distributed to other
nodes across computer networks. This is called as sharding.
∑ MongoDb supports rich query to fetch data from the database.
∑ MongoDb supports replacing an entire document (database) or some specific fields with it's
update() command.
∑ MongoDb supports Map/Reduce framework for batch processing of data and aggregation
operation. Here is brief of how Map/Reduce works :
∑ Map : A master node takes an input. Splits it into smaller sections. Sends it to the associated
nodes.
∑ These nodes may perform the same operation in turn to send those smaller section of input to
other nodes. It process the problem (taken as input) and sends it back to the Master Node.
∑ Reduce : The master node aggregates those results to find the output.
∑ GridFS specification of MongoDb supports storage of very large files.
∑ MongoDb supports various programming languages like C, C# and .NET, C++, Erlang, Haskell,
Java, Javascript, Perl, PHP, Python, Ruby, Scala (via Casbah).
∑ It supports Server-side JavaScript execution. Which allows a developer to use a single
programming language for both client and server side code.
∑ MongoDb is easily installable.
MongoDB Fundamentals : Frequently Asked Questions
What kind of database is MongoDB?
MongoDB is a document-oriented DBMS. Think of MySQL but with JSON-like
objects comprising the data mode, rather than RDBMS tables. MongoDB
supports neither joins nor transactions.
Do MongoDB database stores its data in tables?
A MongoDB database stores its data in collections instead of tables, which are
the rough equivalent of RDBMS tables.
Do MongoDB databases have schemas?
MongoDB uses dynamic schemas. Without defining the structure you can create
collections, i.e. the fields or the types of their values, of the documents in the
collection. You can change the structure of documents simply by adding new
fields or deleting existing ones.
Which programming languages can be used to work with MongoDB?
MongoDB client drivers exist for all of the most popular programming languages.
See the latest list of drivers for details.
Does MongoDB support SQL?
No.
What are typical uses for MongoDB?
Content management systems, mobile applications, gaming, e-commerce,
analytics, archiving, and logging.
Does MongoDB support transactions?
No. However, MongoDB does provide atomic operations on a single document.
Does MongoDB require a lot of RAM?
Not necessarily. It's certainly possible to run MongoDB on a machine with a small
amount of free RAM. MongoDB automatically uses all free memory on the
machine as its cache.
Does MongoDB handle caching?
Yes. MongoDB keeps all of the most recently used data in RAM. If you have
created indexes for your queries and your working data set fits in RAM,
MongoDB serves all queries from memory.
What are the limitations of 32-bit versions of MongoDB?
Changed in version 3.0: Commercial support is no longer provided for MongoDB
on 32-bit platforms (Linux and Windows).
History
Development of MongoDB began in October 2007 by 10gen. The first public
release was in February 2009.
Obtain MongoDb
You can download MongoDb from http://www.mongodb.org/downloads. As of this
writing, it supports following platforms:
∑ OS X 32-bit
∑ OS X 64-bit
∑ Linux 32-bit
∑ Linux 64-bit
∑ Windows 32-bit
∑ Windows 64-bit
∑ Solaris i86pc
∑ Solaris 64
∑ You can download the source and install MongoDb from that too.
MongoDB : Databases, Schemas and Tables
Databases : MongoDB is a document-oriented DBMS, with JSON-like objects
comprising the data model, rather than RDBMS tables. MongoDB does not
support joins nor transactions. However, it features secondary indexes, an
expressive query language, atomic writes on a per-document level, and fully-
consistent reads. MongoDB uses BSON, a binary object format similar to, but
more expressive than JSON.
Schemas : MongoDB uses dynamic schemas. We can create collections without
defining the structure, i.e. the fields or the types of their values, of the
documents. You can change the structure of documents simply by adding new
fields or deleting existing ones. Documents in a collection need unique set of
fields.
Tables : MongoDB database stores its data in collections not in tables The
collections are the rough equivalent of RDBMS tables. A collection holds one or
more documents, which corresponds to a record or a row in a relational database
table, and each document has one or more fields, which corresponds to a
column in a relational database table.
MongoDB and ACID transactions
MongoDB does not support multi-document transactions, but provides atomic
operations on a single document. Often these document-level atomic operations
are sufficient to solve problems that would require ACID transactions in a
relational database.
In MongoDB, you can embed related data in nested arrays or nested documents
within a single document and update the entire document in a single atomic
operation. Relational databases might represent the same kind of data with
multiple tables and rows, which would require transaction support to update the
data atomically.
MongoDB allows clients to read documents inserted or modified before it
commits these modifications to disk, regardless of write concern level or
journaling configuration. Applications may observe two classes of behaviors :
∑ MongoDB will allow clients to read the results of a write operation before the write operation
returns for systems with multiple concurrent readers and writers
∑ If the mongodb terminates before the journal commits, even if a write returns successfully,
queries may have read data that will not exist after the mongodb restarts.
Other database systems refer to these isolation semantics as read uncommitted.
For all inserts and updates, MongoDB modifies
∑ each document in isolation
∑ clients never see documents in intermediate states
For multi-document operations, MongoDB does not provide any multi-document
transactions or isolation. When mongodb returns a successful journaled write
concern, the data is fully committed to disk and will be available after mongodb
restarts. For replica sets, write operations are durable only after a write replicates
and commits to the journal of a majority of the voting members of the set.
MongoDB and caching
MongoDB has no configurable cache. MongoDB uses all free memory on the
system automatically by way of memory-mapped files. Operating systems use
the same approach with their file system caches. MongoDB keeps all of the most
recently used data in RAM. If you have created indexes for your queries and your
working data set fits in RAM, MongoDB serves all queries from memory.
MongoDB does not implement a query cache, it serves all queries directly from
the indexes and/or data files.
Tools
There are several tools available for managing MongoDB.
Monitoring
Network and System monitoring tool Munin has a plugin available for MongoDB.
Distributes high-performance system monitoring tool Gangila has a plugin
available for MongoDB.
Open source web based graphic tool Cacti, used to graph CPU load, network
bandwidth utilization, has a plugin available for MongoDB.
GUI
∑ Fang of Mongo is a web-based user interface built with Django and jQuery.
∑ Futon4Mongo is a clone of the CouchDB Futon web interface for MongoDB.
∑ Mongo3 is a Ruby-based interface.
∑ MongoHub is a native OS X application for managing MongoDB.
∑ Opricot is a browser-based MongoDB shell written in PHP.
∑ phpMoAdmin is a PHP based MongoDb management tool.
∑ MongoVUE is a Windows based GUI to work with MongoDB.
∑ RockMongo is a PHP based MongoDB administration GUI tool.
MongoDB in production
Here is a list of a few MongoDB production deployment:
∑ Craiglist uses MongoDb to archive there billions of records.
∑ FourSquare, a location based social networking site, uses MongoDb to shrade there data over a
number of machines on Amazon EC2.
∑ Shutterfly, an Internet-based social expression and personal publishing service, uses MongoDb
for various persistent data storage requirements.
∑ bit.ly, a web based url shortening service, uses MongoDb for storing their data.
∑ spike.com, a MTV Network's associate, uses MongoDB.
∑ Intuit, a large provider of software and services for small businesses and individuals, uses
MongoDB to track user engagement and activity in real-time across its network of websites for
small businesses.
∑ sourceforge.net, a site to find, create and publish Open Source Software for free, uses
MongoDB for back-end storage.
∑ etsy.com, a site to buy and sell handmade items, uses MongoDB.
∑ The New York Times, one of the leading online news portal, is using MongoDB in a form-
building application for photo submissions.
∑ CERN, the prestigious particle Physics research institute, uses MongoDB for Large Hadron
Collider data.
What is ExpressJs?
Express is a framework of Node.js that allows you to use several very useful and powerful
features without having to reinvent the wheel, helps you organize your application's routing
and use any templating solution with minimal effort. It also allows for much better
organization of your code. In my personal opinion, Express.js is the best Node.js framework
but Meteor.js, Derby.js, Sails.js and Flatiron.js are some of the best alternatives. Especially
Meteor which is more of a full stack framework is superb and can do quite impressive things
with minimal effort.
What is AngularJs?
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your
template language and lets you extend HTML's syntax to express your application's
components clearly and succinctly. Angular's data binding and dependency injection eliminate
much of the code you would otherwise have to write.
<!DOCTYPE html>
<html>
<script
src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="">
<p>Input something in the input box:</p>
<p>Name : <input type="text" ng-model="name" placeholder="Enter name here"></p>
<h1>Hello {{name}}</h1>
</div>
</body>
</html>
For info visit PHP Support Desk

More Related Content

What's hot (20)

Node js
Node js
umesh patil
 
Node js crash course session 5
Node js crash course session 5
Abdul Rahman Masri Attal
 
Node js for beginners
Node js for beginners
Arjun Sreekumar
 
Introduction to REST API with Node.js
Introduction to REST API with Node.js
Yoann Gotthilf
 
Node js crash course session 3
Node js crash course session 3
Abdul Rahman Masri Attal
 
NodeJS ecosystem
NodeJS ecosystem
Yukti Kaura
 
Web Development with AngularJS, NodeJS and ExpressJS
Web Development with AngularJS, NodeJS and ExpressJS
João Rocha da Silva
 
Ajax xml json
Ajax xml json
Andrii Siusko
 
MongoDB basics & Introduction
MongoDB basics & Introduction
Jerwin Roy
 
Ng init | EPI Sousse
Ng init | EPI Sousse
Hamdi Hmidi
 
Top 10 frameworks of node js
Top 10 frameworks of node js
HabileLabs
 
Using Webservice in iOS
Using Webservice in iOS
Mahboob Nur
 
Mongodb tutorial by Rajendra Arora
Mongodb tutorial by Rajendra Arora
Rajendra Arora
 
Mongo db
Mongo db
Raghu nath
 
Optimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at Localytics
andrew311
 
Webinar Back to Basics 3 - Introduzione ai Replica Set
Webinar Back to Basics 3 - Introduzione ai Replica Set
MongoDB
 
MongoDB on Windows Azure
MongoDB on Windows Azure
MongoDB
 
Flask jwt authentication tutorial
Flask jwt authentication tutorial
Katy Slemon
 
Mongodb
Mongodb
Scott Motte
 
Introduction to mongo db
Introduction to mongo db
NexThoughts Technologies
 
Introduction to REST API with Node.js
Introduction to REST API with Node.js
Yoann Gotthilf
 
NodeJS ecosystem
NodeJS ecosystem
Yukti Kaura
 
Web Development with AngularJS, NodeJS and ExpressJS
Web Development with AngularJS, NodeJS and ExpressJS
João Rocha da Silva
 
MongoDB basics & Introduction
MongoDB basics & Introduction
Jerwin Roy
 
Ng init | EPI Sousse
Ng init | EPI Sousse
Hamdi Hmidi
 
Top 10 frameworks of node js
Top 10 frameworks of node js
HabileLabs
 
Using Webservice in iOS
Using Webservice in iOS
Mahboob Nur
 
Mongodb tutorial by Rajendra Arora
Mongodb tutorial by Rajendra Arora
Rajendra Arora
 
Optimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at Localytics
andrew311
 
Webinar Back to Basics 3 - Introduzione ai Replica Set
Webinar Back to Basics 3 - Introduzione ai Replica Set
MongoDB
 
MongoDB on Windows Azure
MongoDB on Windows Azure
MongoDB
 
Flask jwt authentication tutorial
Flask jwt authentication tutorial
Katy Slemon
 

Viewers also liked (20)

EAIESB TIBCO EXPERTISE
EAIESB TIBCO EXPERTISE
Vijay Reddy
 
Introduction to Node.JS Express
Introduction to Node.JS Express
Eueung Mulyana
 
NodeJS_Presentation
NodeJS_Presentation
Arpita Patel
 
Mule ESB session day 1
Mule ESB session day 1
kkk_f17
 
Enterprise Integration Patterns
Enterprise Integration Patterns
Oleg Tsal-Tsalko
 
Managing Patient SatLEADfor4-25-13
Managing Patient SatLEADfor4-25-13
alfred lopez
 
Node JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web App
Edureka!
 
Module design pattern i.e. express js
Module design pattern i.e. express js
Ahmed Assaf
 
Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success
WSO2
 
Enterprise Integration Patterns
Enterprise Integration Patterns
Johan Aludden
 
Enterprise Integration Patterns
Enterprise Integration Patterns
Sergey Podolsky
 
Node JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web App
Edureka!
 
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Kai Wähner
 
Node js
Node js
Rohan Chandane
 
Implementation in mule esb
Implementation in mule esb
Vamsi Krishna
 
API and SOA: Two Sides of the Same Coin?
API and SOA: Two Sides of the Same Coin?
Akana
 
Differentiating between web APIs, SOA, & integration …and why it matters
Differentiating between web APIs, SOA, & integration …and why it matters
Kim Clark
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices Architectures
Apcera
 
REST vs. Messaging For Microservices
REST vs. Messaging For Microservices
Eberhard Wolff
 
Express JS
Express JS
Designveloper
 
EAIESB TIBCO EXPERTISE
EAIESB TIBCO EXPERTISE
Vijay Reddy
 
Introduction to Node.JS Express
Introduction to Node.JS Express
Eueung Mulyana
 
NodeJS_Presentation
NodeJS_Presentation
Arpita Patel
 
Mule ESB session day 1
Mule ESB session day 1
kkk_f17
 
Enterprise Integration Patterns
Enterprise Integration Patterns
Oleg Tsal-Tsalko
 
Managing Patient SatLEADfor4-25-13
Managing Patient SatLEADfor4-25-13
alfred lopez
 
Node JS Express: Steps to Create Restful Web App
Node JS Express: Steps to Create Restful Web App
Edureka!
 
Module design pattern i.e. express js
Module design pattern i.e. express js
Ahmed Assaf
 
Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success
WSO2
 
Enterprise Integration Patterns
Enterprise Integration Patterns
Johan Aludden
 
Enterprise Integration Patterns
Enterprise Integration Patterns
Sergey Podolsky
 
Node JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web App
Edureka!
 
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Enterprise Integration Patterns Revisited (again) for the Era of Big Data, In...
Kai Wähner
 
Implementation in mule esb
Implementation in mule esb
Vamsi Krishna
 
API and SOA: Two Sides of the Same Coin?
API and SOA: Two Sides of the Same Coin?
Akana
 
Differentiating between web APIs, SOA, & integration …and why it matters
Differentiating between web APIs, SOA, & integration …and why it matters
Kim Clark
 
Integration Patterns and Anti-Patterns for Microservices Architectures
Integration Patterns and Anti-Patterns for Microservices Architectures
Apcera
 
REST vs. Messaging For Microservices
REST vs. Messaging For Microservices
Eberhard Wolff
 
Ad

Similar to Node Js, AngularJs and Express Js Tutorial (20)

MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
Shiv K Sah
 
MongoDB presentation
MongoDB presentation
Hyphen Call
 
how_can_businesses_address_storage_issues_using_mongodb.pptx
how_can_businesses_address_storage_issues_using_mongodb.pptx
sarah david
 
What is mean stack?
What is mean stack?
Rishabh Saxena
 
Mongo db dhruba
Mongo db dhruba
Dhrubaji Mandal ♛
 
Pros and Cons of MongoDB in Web Development
Pros and Cons of MongoDB in Web Development
Nirvana Canada
 
how_can_businesses_address_storage_issues_using_mongodb.pdf
how_can_businesses_address_storage_issues_using_mongodb.pdf
sarah david
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx
75waytechnologies
 
nodejs.pptx
nodejs.pptx
shamsullah shamsi
 
Mongo db transcript
Mongo db transcript
foliba
 
Introduction to mean and mern || Event by DSC UNIDEB
Introduction to mean and mern || Event by DSC UNIDEB
Muhammad Raza
 
Analytical data processing
Analytical data processing
Polad Saruxanov
 
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_ advanced learning.pptx
ozakamal8
 
05201349_Unit_7_FSWD_II(1) with advance.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
ozakamal8
 
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_ advanced learning.pptx
ozakamal8
 
05201349_Unit_7_FSWD_II(1) with advance.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
ozakamal8
 
Hands on Big Data Analysis with MongoDB - Cloud Expo Bootcamp NYC
Hands on Big Data Analysis with MongoDB - Cloud Expo Bootcamp NYC
Laura Ventura
 
Mongo db
Mongo db
Gyanendra Yadav
 
edit and approve 2
edit and approve 2
Bhavani Testone
 
upload.txt
upload.txt
IshNexus
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
Shiv K Sah
 
MongoDB presentation
MongoDB presentation
Hyphen Call
 
how_can_businesses_address_storage_issues_using_mongodb.pptx
how_can_businesses_address_storage_issues_using_mongodb.pptx
sarah david
 
Pros and Cons of MongoDB in Web Development
Pros and Cons of MongoDB in Web Development
Nirvana Canada
 
how_can_businesses_address_storage_issues_using_mongodb.pdf
how_can_businesses_address_storage_issues_using_mongodb.pdf
sarah david
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx
75waytechnologies
 
Mongo db transcript
Mongo db transcript
foliba
 
Introduction to mean and mern || Event by DSC UNIDEB
Introduction to mean and mern || Event by DSC UNIDEB
Muhammad Raza
 
Analytical data processing
Analytical data processing
Polad Saruxanov
 
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_ advanced learning.pptx
ozakamal8
 
05201349_Unit_7_FSWD_II(1) with advance.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
ozakamal8
 
05201349_Unit_7_FSWD_ advanced learning.pptx
05201349_Unit_7_FSWD_ advanced learning.pptx
ozakamal8
 
05201349_Unit_7_FSWD_II(1) with advance.pptx
05201349_Unit_7_FSWD_II(1) with advance.pptx
ozakamal8
 
Hands on Big Data Analysis with MongoDB - Cloud Expo Bootcamp NYC
Hands on Big Data Analysis with MongoDB - Cloud Expo Bootcamp NYC
Laura Ventura
 
upload.txt
upload.txt
IshNexus
 
Ad

Recently uploaded (20)

rosoft PowcgnggerPoint Presentation.pptx
rosoft PowcgnggerPoint Presentation.pptx
sirbabu778
 
Fast Reroute in SR-MPLS, presented at bdNOG 19
Fast Reroute in SR-MPLS, presented at bdNOG 19
APNIC
 
Vigilanti-Cura-Protecting-the-Faith.pptx
Vigilanti-Cura-Protecting-the-Faith.pptx
secretarysocom
 
simple-presentationtestingdocument2007.pptx
simple-presentationtestingdocument2007.pptx
ashokjayapal
 
The it.com Domains Brand Book for registrars, domain resellers and hosting co...
The it.com Domains Brand Book for registrars, domain resellers and hosting co...
it.com Domains
 
Timeline Infographics Para utilização diária
Timeline Infographics Para utilização diária
meslellis
 
Topic 1 Foundational IT Infrastructure_.pptx
Topic 1 Foundational IT Infrastructure_.pptx
oneillp100
 
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
Taqyea
 
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
17218
 
Top Mobile App Development Trends Shaping the Future
Top Mobile App Development Trends Shaping the Future
ChicMic Studios
 
3 years of Quarkus in production, what have we learned - Devoxx Polen
3 years of Quarkus in production, what have we learned - Devoxx Polen
Jago de Vreede
 
Lecture 3.1 Analysing the Global Business Environment .pptx
Lecture 3.1 Analysing the Global Business Environment .pptx
shofalbsb
 
AI theory work for students to understand the logic
AI theory work for students to understand the logic
areeba15775n
 
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
secretarysocom
 
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
Jason Packer
 
05-introduction-to-operating-systems.pptx
05-introduction-to-operating-systems.pptx
pepecompany1
 
Communio-et-Progressio - Catholic Church Document on communication
Communio-et-Progressio - Catholic Church Document on communication
secretarysocom
 
COMPUTER ETHICS AND CRIME.......................................................
COMPUTER ETHICS AND CRIME.......................................................
FOOLKUMARI
 
LpQuantueer rtwrt 1e erere errerqer m.ppt
LpQuantueer rtwrt 1e erere errerqer m.ppt
cyberesearchprof
 
PPT 18.03.2023.pptx for i smart programme
PPT 18.03.2023.pptx for i smart programme
AbhimanShastry
 
rosoft PowcgnggerPoint Presentation.pptx
rosoft PowcgnggerPoint Presentation.pptx
sirbabu778
 
Fast Reroute in SR-MPLS, presented at bdNOG 19
Fast Reroute in SR-MPLS, presented at bdNOG 19
APNIC
 
Vigilanti-Cura-Protecting-the-Faith.pptx
Vigilanti-Cura-Protecting-the-Faith.pptx
secretarysocom
 
simple-presentationtestingdocument2007.pptx
simple-presentationtestingdocument2007.pptx
ashokjayapal
 
The it.com Domains Brand Book for registrars, domain resellers and hosting co...
The it.com Domains Brand Book for registrars, domain resellers and hosting co...
it.com Domains
 
Timeline Infographics Para utilização diária
Timeline Infographics Para utilização diária
meslellis
 
Topic 1 Foundational IT Infrastructure_.pptx
Topic 1 Foundational IT Infrastructure_.pptx
oneillp100
 
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
最新版美国威斯康星大学绿湾分校毕业证(UWGB毕业证书)原版定制
Taqyea
 
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
UV_Unwrapping_Lecture_with_Figures.pptx presentation for lecture of animation
17218
 
Top Mobile App Development Trends Shaping the Future
Top Mobile App Development Trends Shaping the Future
ChicMic Studios
 
3 years of Quarkus in production, what have we learned - Devoxx Polen
3 years of Quarkus in production, what have we learned - Devoxx Polen
Jago de Vreede
 
Lecture 3.1 Analysing the Global Business Environment .pptx
Lecture 3.1 Analysing the Global Business Environment .pptx
shofalbsb
 
AI theory work for students to understand the logic
AI theory work for students to understand the logic
areeba15775n
 
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
Inter-Mirifica-Navigating-Media-in-the-Modern-World.pptx
secretarysocom
 
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
CBUSDAW - Ash Lewis - Reducing LLM Hallucinations
Jason Packer
 
05-introduction-to-operating-systems.pptx
05-introduction-to-operating-systems.pptx
pepecompany1
 
Communio-et-Progressio - Catholic Church Document on communication
Communio-et-Progressio - Catholic Church Document on communication
secretarysocom
 
COMPUTER ETHICS AND CRIME.......................................................
COMPUTER ETHICS AND CRIME.......................................................
FOOLKUMARI
 
LpQuantueer rtwrt 1e erere errerqer m.ppt
LpQuantueer rtwrt 1e erere errerqer m.ppt
cyberesearchprof
 
PPT 18.03.2023.pptx for i smart programme
PPT 18.03.2023.pptx for i smart programme
AbhimanShastry
 

Node Js, AngularJs and Express Js Tutorial

  • 1. Stack RESTful API Tutorial - Using MongoDB, Express, Angular JS, and Node JS Together Before starting on these let us discuss about the platforms terms. What is NodeJs? Node.js is a server side platform built on Google Chrome's JavaScript Engine (V8 Engine). Node.js was developed by Ryan Dahl in 2009 and its latest version is v0.10.36. The definition of Node.js as supplied by its official documentation is as follows − 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 is an open source, cross-platform runtime environment for developing server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, and Linux. Node.js also provides a rich library of various JavaScript modules which simplifies the development of web applications using Node.js to a great extent. Node.js = Runtime Environment + JavaScript Library Features of Node.js Following are some of the important features that make Node.js the first choice of software architects. ∑ Asynchronous and Event Driven All APIs of Node.js library are asynchronous that is, non-blocking. It essentially means 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.
  • 2. ∑ Very Fast Being built on Google Chrome's V8 JavaScript Engine, Node.js library is very fast in code execution. ∑ Single Threaded but Highly Scalable - Node.js uses a single threaded model with event looping. Event mechanism helps the server to respond in a non- blocking way and makes the server highly scalable as opposed to traditional servers which create limited threads to handle requests. Node.js uses a single threaded program and the same program can provide service to a much larger number of requests than traditional servers like Apache HTTP Server. ∑ No Buffering - Node.js applications never buffer any data. These applications simply output the data in chunks. ∑ License - Node.js is released under the MIT license. Who Uses Node.js? Following is the link on github wiki containing an exhaustive list of projects, application and companies which are using Node.js. This list includes eBay, General Electric, GoDaddy, Microsoft, PayPal, Uber, Wikipins, Yahoo!, and Yammer to name a few. ∑ Projects, Applications, and Companies Using Node Concepts The following diagram depicts some important parts of Node.js which we will discuss in detail in the subsequent chapters.
  • 3. Where to Use Node.js? Following are the areas where Node.js is proving itself as a perfect technology partner. ∑ I/O bound Applications ∑ Data Streaming Applications ∑ Data Intensive Real time Applications (DIRT) ∑ JSON APIs based Applications ∑ Single Page Applications Where Not to Use Node.js? It is not advisable to use Node.js for CPU intensive applications. What is MongoDb? MongoDb is a Open Source database written in C++. Drivers and client libraries are typically written in their respective languages, although some drivers use C extensions for better performance. If the load increases, by adding more nodes (such as a computer), the performance can be retained.
  • 4. It can be used to store data for very high performance applications (for example Foursquare is using it in production). MongoDB does not support SQL It supports a rich, ad-hoc query language of its own. MongoDb stores data as documents. So it is a document oriented database. FirstName="Arun", Address="St. Xavier's Road", Spouse=[{Name:"Kiran"}], Children=[{Name:"Rihit", Age:8}]. FirstName="Sameer",Address="8 Gandhi Road". Notice there are two different documents (separated by "."). Storing data in this fashion is called asdocument oriented database. MongoDb is a document oriented database. Key Features Since MongoDb offers a Document oriented storage, It is simple and easily programmable. ∑ You can set an index on any attribute of a MongoDb record (as FirstName="Sameer",Address="8 Gandhi Road"), with respect to which, a record can be sort quickly and ordered. ∑ You can set mirror across local as well as wide area networks, which makes it easily scalable. ∑ If load increases (more storage space, more processing power), it can be distributed to other nodes across computer networks. This is called as sharding. ∑ MongoDb supports rich query to fetch data from the database. ∑ MongoDb supports replacing an entire document (database) or some specific fields with it's update() command. ∑ MongoDb supports Map/Reduce framework for batch processing of data and aggregation operation. Here is brief of how Map/Reduce works : ∑ Map : A master node takes an input. Splits it into smaller sections. Sends it to the associated nodes. ∑ These nodes may perform the same operation in turn to send those smaller section of input to other nodes. It process the problem (taken as input) and sends it back to the Master Node.
  • 5. ∑ Reduce : The master node aggregates those results to find the output. ∑ GridFS specification of MongoDb supports storage of very large files. ∑ MongoDb supports various programming languages like C, C# and .NET, C++, Erlang, Haskell, Java, Javascript, Perl, PHP, Python, Ruby, Scala (via Casbah). ∑ It supports Server-side JavaScript execution. Which allows a developer to use a single programming language for both client and server side code. ∑ MongoDb is easily installable. MongoDB Fundamentals : Frequently Asked Questions What kind of database is MongoDB? MongoDB is a document-oriented DBMS. Think of MySQL but with JSON-like objects comprising the data mode, rather than RDBMS tables. MongoDB supports neither joins nor transactions. Do MongoDB database stores its data in tables? A MongoDB database stores its data in collections instead of tables, which are the rough equivalent of RDBMS tables. Do MongoDB databases have schemas? MongoDB uses dynamic schemas. Without defining the structure you can create collections, i.e. the fields or the types of their values, of the documents in the collection. You can change the structure of documents simply by adding new fields or deleting existing ones. Which programming languages can be used to work with MongoDB? MongoDB client drivers exist for all of the most popular programming languages. See the latest list of drivers for details. Does MongoDB support SQL? No. What are typical uses for MongoDB? Content management systems, mobile applications, gaming, e-commerce, analytics, archiving, and logging. Does MongoDB support transactions? No. However, MongoDB does provide atomic operations on a single document. Does MongoDB require a lot of RAM? Not necessarily. It's certainly possible to run MongoDB on a machine with a small amount of free RAM. MongoDB automatically uses all free memory on the machine as its cache. Does MongoDB handle caching? Yes. MongoDB keeps all of the most recently used data in RAM. If you have created indexes for your queries and your working data set fits in RAM, MongoDB serves all queries from memory.
  • 6. What are the limitations of 32-bit versions of MongoDB? Changed in version 3.0: Commercial support is no longer provided for MongoDB on 32-bit platforms (Linux and Windows). History Development of MongoDB began in October 2007 by 10gen. The first public release was in February 2009. Obtain MongoDb You can download MongoDb from http://www.mongodb.org/downloads. As of this writing, it supports following platforms: ∑ OS X 32-bit ∑ OS X 64-bit ∑ Linux 32-bit ∑ Linux 64-bit ∑ Windows 32-bit ∑ Windows 64-bit ∑ Solaris i86pc ∑ Solaris 64 ∑ You can download the source and install MongoDb from that too. MongoDB : Databases, Schemas and Tables Databases : MongoDB is a document-oriented DBMS, with JSON-like objects comprising the data model, rather than RDBMS tables. MongoDB does not support joins nor transactions. However, it features secondary indexes, an expressive query language, atomic writes on a per-document level, and fully- consistent reads. MongoDB uses BSON, a binary object format similar to, but more expressive than JSON. Schemas : MongoDB uses dynamic schemas. We can create collections without defining the structure, i.e. the fields or the types of their values, of the documents. You can change the structure of documents simply by adding new fields or deleting existing ones. Documents in a collection need unique set of fields. Tables : MongoDB database stores its data in collections not in tables The collections are the rough equivalent of RDBMS tables. A collection holds one or more documents, which corresponds to a record or a row in a relational database
  • 7. table, and each document has one or more fields, which corresponds to a column in a relational database table. MongoDB and ACID transactions MongoDB does not support multi-document transactions, but provides atomic operations on a single document. Often these document-level atomic operations are sufficient to solve problems that would require ACID transactions in a relational database. In MongoDB, you can embed related data in nested arrays or nested documents within a single document and update the entire document in a single atomic operation. Relational databases might represent the same kind of data with multiple tables and rows, which would require transaction support to update the data atomically. MongoDB allows clients to read documents inserted or modified before it commits these modifications to disk, regardless of write concern level or journaling configuration. Applications may observe two classes of behaviors : ∑ MongoDB will allow clients to read the results of a write operation before the write operation returns for systems with multiple concurrent readers and writers ∑ If the mongodb terminates before the journal commits, even if a write returns successfully, queries may have read data that will not exist after the mongodb restarts. Other database systems refer to these isolation semantics as read uncommitted. For all inserts and updates, MongoDB modifies ∑ each document in isolation ∑ clients never see documents in intermediate states For multi-document operations, MongoDB does not provide any multi-document transactions or isolation. When mongodb returns a successful journaled write concern, the data is fully committed to disk and will be available after mongodb restarts. For replica sets, write operations are durable only after a write replicates and commits to the journal of a majority of the voting members of the set. MongoDB and caching MongoDB has no configurable cache. MongoDB uses all free memory on the system automatically by way of memory-mapped files. Operating systems use the same approach with their file system caches. MongoDB keeps all of the most recently used data in RAM. If you have created indexes for your queries and your working data set fits in RAM, MongoDB serves all queries from memory.
  • 8. MongoDB does not implement a query cache, it serves all queries directly from the indexes and/or data files. Tools There are several tools available for managing MongoDB. Monitoring Network and System monitoring tool Munin has a plugin available for MongoDB. Distributes high-performance system monitoring tool Gangila has a plugin available for MongoDB. Open source web based graphic tool Cacti, used to graph CPU load, network bandwidth utilization, has a plugin available for MongoDB. GUI ∑ Fang of Mongo is a web-based user interface built with Django and jQuery. ∑ Futon4Mongo is a clone of the CouchDB Futon web interface for MongoDB. ∑ Mongo3 is a Ruby-based interface. ∑ MongoHub is a native OS X application for managing MongoDB. ∑ Opricot is a browser-based MongoDB shell written in PHP. ∑ phpMoAdmin is a PHP based MongoDb management tool. ∑ MongoVUE is a Windows based GUI to work with MongoDB. ∑ RockMongo is a PHP based MongoDB administration GUI tool. MongoDB in production Here is a list of a few MongoDB production deployment: ∑ Craiglist uses MongoDb to archive there billions of records. ∑ FourSquare, a location based social networking site, uses MongoDb to shrade there data over a number of machines on Amazon EC2. ∑ Shutterfly, an Internet-based social expression and personal publishing service, uses MongoDb for various persistent data storage requirements. ∑ bit.ly, a web based url shortening service, uses MongoDb for storing their data. ∑ spike.com, a MTV Network's associate, uses MongoDB.
  • 9. ∑ Intuit, a large provider of software and services for small businesses and individuals, uses MongoDB to track user engagement and activity in real-time across its network of websites for small businesses. ∑ sourceforge.net, a site to find, create and publish Open Source Software for free, uses MongoDB for back-end storage. ∑ etsy.com, a site to buy and sell handmade items, uses MongoDB. ∑ The New York Times, one of the leading online news portal, is using MongoDB in a form- building application for photo submissions. ∑ CERN, the prestigious particle Physics research institute, uses MongoDB for Large Hadron Collider data. What is ExpressJs? Express is a framework of Node.js that allows you to use several very useful and powerful features without having to reinvent the wheel, helps you organize your application's routing and use any templating solution with minimal effort. It also allows for much better organization of your code. In my personal opinion, Express.js is the best Node.js framework but Meteor.js, Derby.js, Sails.js and Flatiron.js are some of the best alternatives. Especially Meteor which is more of a full stack framework is superb and can do quite impressive things with minimal effort. What is AngularJs? AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you would otherwise have to write. <!DOCTYPE html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <body> <div ng-app=""> <p>Input something in the input box:</p> <p>Name : <input type="text" ng-model="name" placeholder="Enter name here"></p> <h1>Hello {{name}}</h1> </div>
  • 10. </body> </html> For info visit PHP Support Desk