SlideShare a Scribd company logo
API Driven Applications
AngularJS, NodeJS and MongoDB
@HmidiHamdi
JSA | JCertif TN
Software Engeneering | ISSATSo
Member & Founder | ISSATSo Google Club
Agenda
- API Driven Application
- Getting started with Angular JS
- Basics Of Node JS
- Discovering MongoDB
API DRIVEN APPLICATION
REST API
REST = Representation State Transfer.
- Client Sends HTTP verbs(GET, POST,
DELETE, PUT) along with a URL and
variable parameters that are unlencoded.
- The URL tells us what object to act on.
- Server Replies with a result code and valid
JSON.
HTTP Verbs - CRUD
- GET : when a client want to read an object.
- POST : when a client want to ceate an
object.
- PUT : when a client want to update an
object.
- DELETE : when a client want to delete an
object.
Why REST API ?
a simple way to create a data service enabling
you to easy create all your other applications:
- HTML5 / JAVASCRIPT.
- ANDROID.
- IOS.
MEAN STACK
M : MongoDB (Most Popular NoSql DataBase).
E : ExpressJS (Web Application Framework).
A : AngularJS (A Robust Framework for
creating HTML5 and Javascript rich web
Applications).
N : NodeJS (Server-side Javascript interpreter).
Our Example :
API  Driven Application - AngulatJS, NodeJS and MongoDB | JCertif Tunisia 2015
●
●
●
●
●
●
●
●
●
<!doctype html>
<html>
<head ng-app >
<title>Exemple 1</title>
<SCRIPT TYPE="text/javascript" src="JS/angular.min.js">
</SCRIPT>
</head>
<body >
<input type="text" ng-model="name" >
<h1>Hello {{name}} </h1>
</body>
</html>
Directives
<html ng-app>
<input type="text" ng-model="name" >
<ng-view > </ng-view>
Model
Controller & $Scope
Events
● ng-click
● ng-hide/ng-show
● ng-dbl-click
● ng-keydown
● ng-keyup
Routing
AJAX
Let’s Drive in
API  Driven Application - AngulatJS, NodeJS and MongoDB | JCertif Tunisia 2015
What is NodeJS ?
● Open Source, Cross-platform runtime
environment for server-side and networking
applications.
● NodeJS provides an Event-Driven
architecture and non-blocking I/O API.
● Run your Javascript on Server.
● Uses V8 Engine.
Hello Node JS
Node Package Manager
Express JS
Uses
app.use(express.static(__dirname + '/Public'));
// set the static files location /public/img will be /img for users
app.use(morgan('dev'));
// log every request to the console
app.use(bodyParser.urlencoded({'extended':'true'}));
// parse application/x-www-form-urlencoded
app.use(bodyParser.json());
// parse application/json
app.use(bodyParser.json({ type: 'application/vnd.api+json' }));
// parse application/vnd.api+json as json
app.use(methodOverride());
Routes
app.get('/todos/:id', function (req, res, next) {
var todo=getTodo(id);
res.json(todo);
});
-------------
app.get('/todos', function (req, res, next) {
var todos= getTodos();
res.json(todos);
});
API  Driven Application - AngulatJS, NodeJS and MongoDB | JCertif Tunisia 2015
What is MongoDB?
MongoDB is an Open-Source document-
oriented NoSQL database. It stores data in
JSON-like format.
Why use MongoDB ?
- SQL databases was invented to store data.
- MongoDB stores documents (or) Objects.
- now-a-days, everyone works with Objects
(Python/Ruby/Java/etc).
- And we need Databases to persist our objects.
- why not store objects directly?
- Embedded documents and arrays reduce need for Join.
MongoDB Tools
● Mongo : MongoDB client as a Javascript
shell.
● MongoImport : import CSV, JSON and TSV
data.
● MongoExport : export data as JSON and
CSV.
NoSQL DataBase Terms:
DataBase : Like other Relational DataBases.
Collection : Like Table in RDBMS(Has no
common Schema).
Document : Like a Record in RDBMS or Row.
Field : Like a RDBMS column {key : value }.
Mongoose CRUD(Create, Read, Update,
Delete)
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/MyApp');
var SpeakerSchema = new mongoose.Schema({
name : String ,
img : String,
detail : String
});
var Speaker = mongoose.model('Speaker',SpeakerSchema);
Create
app.post('/NewSpeaker',function(req,res){
var sp = new Speaker({
name : req.body.nameS,
img : req.body.imgS,
detail: req.body.det
});
sp.save(function(err){
if(err)
console.log(err);
else
res.json(sp);
});
});
Read
app.get('/getSpeakers/:Name',function(req,res){
Speaker.findOne({ name: req.params.Name }, function (err, doc){
if (err){
res.send(err);
}
res.json(doc);
});
});
app.get('/getSpeakers',function(req,res){
Speaker.find(function(err, todos) {
if (err){
res.send(err);
}
res.json(todos); // return all todos in JSON format
});
});
Update
● Model.update(conditions, update, [options],
[callback])
Delete
● Model.remove(conditions, [callback])
app.delete('/DeleteSpeaker/:id',function(req,res){
Speaker.remove({ _id : req.params.id}, function (err) {
if (err) return res.send(err);
res.json({"result":"success"});
});
});
<Coding Time !>
<Thank You!>
Hmidihamdi7@gmail.com
/+ HamdiHmidiigcien
/hamdi.igc

More Related Content

PDF
AngularJS Deep Dives (NYC GDG Apr 2013)
PDF
API Days Australia - Automatic Testing of (RESTful) API Documentation
PPTX
Alexey Kupriyanenko "The State of Modern JavaScript and Web in 2020 - Real us...
PDF
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
PDF
AngularJS with RequireJS
PDF
Matthew Eernisse, NodeJs, .toster {webdev}
PPTX
Microservices/dropwizard
PDF
API Days Paris - Automatic Testing of (RESTful) API Documentation
AngularJS Deep Dives (NYC GDG Apr 2013)
API Days Australia - Automatic Testing of (RESTful) API Documentation
Alexey Kupriyanenko "The State of Modern JavaScript and Web in 2020 - Real us...
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
AngularJS with RequireJS
Matthew Eernisse, NodeJs, .toster {webdev}
Microservices/dropwizard
API Days Paris - Automatic Testing of (RESTful) API Documentation

What's hot (20)

PDF
A real-world Relay application in production - Stefano Masini - Codemotion Am...
PDF
[Kotlin Serverless 工作坊] 單元 3 - 實作 JSON API
ZIP
Javascript Everywhere From Nose To Tail
PDF
Workshop 13: AngularJS Parte II
PDF
Redux. From twitter hype to production
PDF
ReactJS vs AngularJS - Head to Head comparison
PDF
Abstracting Just Enough
PDF
Workshop 15: Ionic framework
PDF
«От экспериментов с инфраструктурой до внедрения в продакшен»​
PDF
Redux Universal
PDF
Workshop 25: React Native - Components
PPTX
AngularJS - Architecture decisions in a large project 
PPTX
Frontend technologies
PDF
From ActiveRecord to EventSourcing
PDF
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
PDF
AtlasCamp 2015: How HipChat ships at the speed of awesome
PPTX
Introduction to MongoDB
PDF
Rails course day 6
PPTX
A Brief Introduction to React.js
PDF
Using a simple Ruby program to interface with quickly provisioned cloud appli...
A real-world Relay application in production - Stefano Masini - Codemotion Am...
[Kotlin Serverless 工作坊] 單元 3 - 實作 JSON API
Javascript Everywhere From Nose To Tail
Workshop 13: AngularJS Parte II
Redux. From twitter hype to production
ReactJS vs AngularJS - Head to Head comparison
Abstracting Just Enough
Workshop 15: Ionic framework
«От экспериментов с инфраструктурой до внедрения в продакшен»​
Redux Universal
Workshop 25: React Native - Components
AngularJS - Architecture decisions in a large project 
Frontend technologies
From ActiveRecord to EventSourcing
AWS user group September 2017 - Rob Ribeiro "Seeking Solutions for Debugging ...
AtlasCamp 2015: How HipChat ships at the speed of awesome
Introduction to MongoDB
Rails course day 6
A Brief Introduction to React.js
Using a simple Ruby program to interface with quickly provisioned cloud appli...
Ad

Viewers also liked (20)

PPTX
Cosa ci dicono le particelle "strane"?
PDF
wordpress-based-non-profit-website-redesign-project-by-digital-systems
PPTX
Colors and M
PPTX
An adventure on the red planet
PPTX
Esperimento 1
PDF
prestashop-time-log
PPTX
Pannello solare 2B Iervolino
PPTX
Юлия Федорова, Хорошая программа продает сама себя
PPT
The powerofgreenlight
PPTX
Vulcanizziamoci
PDF
CSS2inCanWestGlobalTemplates
PPT
Radici nello spazio
PPTX
ET chiama Terra
PPTX
новые медиа и создание информационного поля мероприятия
PPT
Проектирование мероприятий. Лариса Малышева для I_Love_Events.conf
PPTX
Letter a new program pp
PPT
Cretaceo 2.0?
PPTX
l calore del colore
PDF
Cubiertas & Fachadas
PPTX
THE FRUITS
Cosa ci dicono le particelle "strane"?
wordpress-based-non-profit-website-redesign-project-by-digital-systems
Colors and M
An adventure on the red planet
Esperimento 1
prestashop-time-log
Pannello solare 2B Iervolino
Юлия Федорова, Хорошая программа продает сама себя
The powerofgreenlight
Vulcanizziamoci
CSS2inCanWestGlobalTemplates
Radici nello spazio
ET chiama Terra
новые медиа и создание информационного поля мероприятия
Проектирование мероприятий. Лариса Малышева для I_Love_Events.conf
Letter a new program pp
Cretaceo 2.0?
l calore del colore
Cubiertas & Fachadas
THE FRUITS
Ad

Similar to API Driven Application - AngulatJS, NodeJS and MongoDB | JCertif Tunisia 2015 (20)

PPTX
Building Web Apps with Express
PDF
Getting started with node JS
PDF
node.js practical guide to serverside javascript
PDF
Express.pdf
PDF
Server Side Swift - AppBuilders 2017
PDF
express of full stack web development notes
PPTX
REST API for your WP7 App
PDF
Angular server side rendering - Strategies & Technics
ODP
An Overview of Node.js
PPT
Node.js Express Framework
PDF
TPSE Thailand 2015 - Rethinking Web with React and Flux
PPTX
Build RESTful API Using Express JS
PDF
Nodejs first class
PPTX
ExpressJS and REST API.pptx
PPTX
Express JS
PDF
Introducing Rendr: Run your Backbone.js apps on the client and server
PDF
Using the new WordPress REST API
ODP
Nodejs Intro - Part2 Introduction to Web Applications
KEY
Writing robust Node.js applications
Building Web Apps with Express
Getting started with node JS
node.js practical guide to serverside javascript
Express.pdf
Server Side Swift - AppBuilders 2017
express of full stack web development notes
REST API for your WP7 App
Angular server side rendering - Strategies & Technics
An Overview of Node.js
Node.js Express Framework
TPSE Thailand 2015 - Rethinking Web with React and Flux
Build RESTful API Using Express JS
Nodejs first class
ExpressJS and REST API.pptx
Express JS
Introducing Rendr: Run your Backbone.js apps on the client and server
Using the new WordPress REST API
Nodejs Intro - Part2 Introduction to Web Applications
Writing robust Node.js applications

More from Hamdi Hmidi (12)

PDF
Ng init | EPI Sousse
PDF
Pentaho | Data Integration & Report designer
PDF
Ng init
PDF
Javascript - Getting started | DevCom ISITCom
PDF
Modern web application devlopment workflow
PDF
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
PDF
Hybrid Mobile Apps | Ionic & AngularJS
PDF
Ng-init
PDF
Ng-init
PDF
Twitter bootstrap | JCertif Tunisie
PDF
Android initiation
PPTX
Les Fondamentaux D'Angular JS | Hmidi Hamdi
Ng init | EPI Sousse
Pentaho | Data Integration & Report designer
Ng init
Javascript - Getting started | DevCom ISITCom
Modern web application devlopment workflow
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
Hybrid Mobile Apps | Ionic & AngularJS
Ng-init
Ng-init
Twitter bootstrap | JCertif Tunisie
Android initiation
Les Fondamentaux D'Angular JS | Hmidi Hamdi

Recently uploaded (20)

PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Road Safety tips for School Kids by a k maurya.pptx
PPTX
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
ETO & MEO Certificate of Competency Questions and Answers
PPTX
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
PPTX
24AI201_AI_Unit_4 (1).pptx Artificial intelligence
PDF
composite construction of structures.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
“Next-Gen AI: Trends Reshaping Our World”
PPT
Drone Technology Electronics components_1
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Geotechnical Engineering, Soil mechanics- Soil Testing.pdf
PPTX
Internship_Presentation_Final engineering.pptx
PPTX
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
DOCX
573137875-Attendance-Management-System-original
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
web development for engineering and engineering
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Road Safety tips for School Kids by a k maurya.pptx
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Structs to JSON How Go Powers REST APIs.pdf
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
ETO & MEO Certificate of Competency Questions and Answers
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
24AI201_AI_Unit_4 (1).pptx Artificial intelligence
composite construction of structures.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
“Next-Gen AI: Trends Reshaping Our World”
Drone Technology Electronics components_1
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Geotechnical Engineering, Soil mechanics- Soil Testing.pdf
Internship_Presentation_Final engineering.pptx
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
573137875-Attendance-Management-System-original
CH1 Production IntroductoryConcepts.pptx
web development for engineering and engineering

API Driven Application - AngulatJS, NodeJS and MongoDB | JCertif Tunisia 2015