ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Tech Talk
Friday, 13 February 2015
Create a RESTful API
Express +
Roadmap
? Express Overview
? MongoDB Overview
? Learn Express Route
? ODM MongoDB with Mongoose
? Handle CRUD for an item
? Use the proper HTTP verbs to make it RESTful (GET,
POST, PUT, and DELETE)
? Return JSON data
Getting Started
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash
$ source ~/.nvm/nvm.sh
$ nvm install v0.10.36
$ nvm alias default 0.10.36
Install and Setup
Install Node.JS using NVM [Node Version Manager] https://github.com/creationix/nvm
Install MongoDB on OS X
Install MongoDB with Homebrew : $ brew install mongodb
http://www.mongodbspain.com/en/2014/11/06/install-mongodb-on-mac-os-x-yosemite/
MongoDB
MongoDB is a document database that provides high
performance, high availability, and easy scalability.
source : http://www.mongodb.org/about/introduction/
Schema Less
Data strore in JSON-like documents with dynamic
Providing ?exibity during the development process
Built-in Javascript :)
OLX-Tech-Talk
¡°Representational State Transfer (REST) is a software
architecture style consisting of guidelines and best practices
for creating scalable web services. REST is a coordinated
set of constraints applied to the design of components in a
distributed hypermedia system that can lead to a more
performant and maintainable architecture.¡±
http://en.wikipedia.org/wiki/Representational_state_transfer
What is REST
Express Apps
$ npm install
$ node server.js
Express Route
curl -i -X POST -H 'Content-Type: application/json' -d '{}' http://localhost:3000/user
curl -i -X PUT -H 'Content-Type: application/json' -d '{}' http://localhost:3000/user
curl -i -X DELETE -H 'Content-Type: application/json' -d '{}' http://localhost:3000/user
curl -i -X GET http://localhost:3000/user
MongoDB with MongooseJS
$ npm install ¡ªsave mongoose
Create MongoDB Model
$ git clone git@github.com:aredo/express-rest-api.git
Source Code
Ad

Recommended

What is AWS S3?
What is AWS S3?
AWS Tutor
?
Server-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick Tour
q3boy
?
Something about node basics
Something about node basics
Philipp Fehre
?
GruntJS + Wordpress
GruntJS + Wordpress
Leonardo Balter
?
Intro to HTTP and Node.js
Intro to HTTP and Node.js
Jean-Luc David
?
Oreilly Webcast Jun17
Oreilly Webcast Jun17
Sean Hull
?
Introduction to MongoDB
Introduction to MongoDB
Jean-Luc David
?
Herramientas front
Herramientas front
borya09
?
Rails with MongoDB - RORLab 47th
Rails with MongoDB - RORLab 47th
Eugene Park
?
Node in Real Time - The Beginning
Node in Real Time - The Beginning
Axilis
?
Banquet 36
Banquet 36
Koubei UED
?
Mongo db in 3 minutes BoilerMake
Mongo db in 3 minutes BoilerMake
Valeri Karpov
?
Webpack | Jakub Kulhan - Skrz.cz
Webpack | Jakub Kulhan - Skrz.cz
skrzczdev
?
(WS14) Sasa Matijasic - Node.js i "novi" web
(WS14) Sasa Matijasic - Node.js i "novi" web
Web::Strategija
?
Quick Introduction to Node.js
Quick Introduction to Node.js
Naing Lin Aung
?
Event Driven Architecture Concepts in Web Technologies - Part 2
Event Driven Architecture Concepts in Web Technologies - Part 2
Hamidreza Soleimani
?
§£§Ý§Ñ§Õ§Ú§Þ§Ú§â §®§Ú§Ô§å§â§à "§¥§Ñ§à Node.js"
§£§Ý§Ñ§Õ§Ú§Þ§Ú§â §®§Ú§Ô§å§â§à "§¥§Ñ§à Node.js"
EPAM Systems
?
Postgis setup
Postgis setup
Timothy Wu
?
CI/CD Pipeline with Octopus Deploy
CI/CD Pipeline with Octopus Deploy
Ebru Cucen ?¨¹?en
?
Capistrano && SystemD
Capistrano && SystemD
Aleksandr Simonov
?
Lw 4.1
Lw 4.1
?? ?
?
Containers > VMs
Containers > VMs
David Timothy Strauss
?
ßMëAʹÓÃNodejs œ\Õ„no sql(mongodb)
ßMëAʹÓÃNodejs œ\Õ„no sql(mongodb)
Simon Su
?
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
DataStax Academy
?
Nodejs quick start
Nodejs quick start
Guangyao Cao
?
MongoDB + Node.JS + EPAM ROAD
MongoDB + Node.JS + EPAM ROAD
Szilveszter Moln¨¢r
?
Amepad lt(tmpfs)
Amepad lt(tmpfs)
Satoshi Udagawa
?
Grunt: the wild boar dev's best friend - WordCamp London 2018
Grunt: the wild boar dev's best friend - WordCamp London 2018
Marco Chiesi
?
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
?
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io
?

More Related Content

What's hot (20)

Rails with MongoDB - RORLab 47th
Rails with MongoDB - RORLab 47th
Eugene Park
?
Node in Real Time - The Beginning
Node in Real Time - The Beginning
Axilis
?
Banquet 36
Banquet 36
Koubei UED
?
Mongo db in 3 minutes BoilerMake
Mongo db in 3 minutes BoilerMake
Valeri Karpov
?
Webpack | Jakub Kulhan - Skrz.cz
Webpack | Jakub Kulhan - Skrz.cz
skrzczdev
?
(WS14) Sasa Matijasic - Node.js i "novi" web
(WS14) Sasa Matijasic - Node.js i "novi" web
Web::Strategija
?
Quick Introduction to Node.js
Quick Introduction to Node.js
Naing Lin Aung
?
Event Driven Architecture Concepts in Web Technologies - Part 2
Event Driven Architecture Concepts in Web Technologies - Part 2
Hamidreza Soleimani
?
§£§Ý§Ñ§Õ§Ú§Þ§Ú§â §®§Ú§Ô§å§â§à "§¥§Ñ§à Node.js"
§£§Ý§Ñ§Õ§Ú§Þ§Ú§â §®§Ú§Ô§å§â§à "§¥§Ñ§à Node.js"
EPAM Systems
?
Postgis setup
Postgis setup
Timothy Wu
?
CI/CD Pipeline with Octopus Deploy
CI/CD Pipeline with Octopus Deploy
Ebru Cucen ?¨¹?en
?
Capistrano && SystemD
Capistrano && SystemD
Aleksandr Simonov
?
Lw 4.1
Lw 4.1
?? ?
?
Containers > VMs
Containers > VMs
David Timothy Strauss
?
ßMëAʹÓÃNodejs œ\Õ„no sql(mongodb)
ßMëAʹÓÃNodejs œ\Õ„no sql(mongodb)
Simon Su
?
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
DataStax Academy
?
Nodejs quick start
Nodejs quick start
Guangyao Cao
?
MongoDB + Node.JS + EPAM ROAD
MongoDB + Node.JS + EPAM ROAD
Szilveszter Moln¨¢r
?
Amepad lt(tmpfs)
Amepad lt(tmpfs)
Satoshi Udagawa
?
Grunt: the wild boar dev's best friend - WordCamp London 2018
Grunt: the wild boar dev's best friend - WordCamp London 2018
Marco Chiesi
?
Rails with MongoDB - RORLab 47th
Rails with MongoDB - RORLab 47th
Eugene Park
?
Node in Real Time - The Beginning
Node in Real Time - The Beginning
Axilis
?
Mongo db in 3 minutes BoilerMake
Mongo db in 3 minutes BoilerMake
Valeri Karpov
?
Webpack | Jakub Kulhan - Skrz.cz
Webpack | Jakub Kulhan - Skrz.cz
skrzczdev
?
(WS14) Sasa Matijasic - Node.js i "novi" web
(WS14) Sasa Matijasic - Node.js i "novi" web
Web::Strategija
?
Quick Introduction to Node.js
Quick Introduction to Node.js
Naing Lin Aung
?
Event Driven Architecture Concepts in Web Technologies - Part 2
Event Driven Architecture Concepts in Web Technologies - Part 2
Hamidreza Soleimani
?
§£§Ý§Ñ§Õ§Ú§Þ§Ú§â §®§Ú§Ô§å§â§à "§¥§Ñ§à Node.js"
§£§Ý§Ñ§Õ§Ú§Þ§Ú§â §®§Ú§Ô§å§â§à "§¥§Ñ§à Node.js"
EPAM Systems
?
Lw 4.1
Lw 4.1
?? ?
?
ßMëAʹÓÃNodejs œ\Õ„no sql(mongodb)
ßMëAʹÓÃNodejs œ\Õ„no sql(mongodb)
Simon Su
?
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
Cassandra Summit 2014: Down with Tweaking! Removing Tunable Complexity for Ca...
DataStax Academy
?
Grunt: the wild boar dev's best friend - WordCamp London 2018
Grunt: the wild boar dev's best friend - WordCamp London 2018
Marco Chiesi
?

Similar to OLX-Tech-Talk (20)

Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
?
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io
?
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Codemotion
?
MongoDB and Node.js
MongoDB and Node.js
Norberto Leite
?
Introduction to MongoDB with PHP
Introduction to MongoDB with PHP
fwso
?
Web mashups with NodeJS
Web mashups with NodeJS
Richard Thomson
?
How do i Meet MongoDB
How do i Meet MongoDB
Antonio Scalzo
?
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
MongoDB
?
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
MongoDB
?
MeaNstack on Docker
MeaNstack on Docker
Daniel Ku
?
Nodejs web,db,hosting
Nodejs web,db,hosting
Kenu, GwangNam Heo
?
Introduction to node.js By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
?
Introduction to MongoDB
Introduction to MongoDB
Chun-Kai Wang
?
Introduction to Node.js
Introduction to Node.js
Winston Hsieh
?
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
leffen
?
Node.js on Azure
Node.js on Azure
Sasha Goldshtein
?
Intro to node and mongodb 1
Intro to node and mongodb 1
Mohammad Qureshi
?
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
?
A Introduction to the World of Node, Javascript & Selenium
A Introduction to the World of Node, Javascript & Selenium
James Eisenhauer
?
NoSQL on microsoft azure april 2014
NoSQL on microsoft azure april 2014
Brian Benz
?
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
?
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io
?
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Codemotion
?
Introduction to MongoDB with PHP
Introduction to MongoDB with PHP
fwso
?
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
MongoDB
?
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
MongoDB
?
MeaNstack on Docker
MeaNstack on Docker
Daniel Ku
?
Introduction to node.js By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
?
Introduction to MongoDB
Introduction to MongoDB
Chun-Kai Wang
?
Introduction to Node.js
Introduction to Node.js
Winston Hsieh
?
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
leffen
?
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
?
A Introduction to the World of Node, Javascript & Selenium
A Introduction to the World of Node, Javascript & Selenium
James Eisenhauer
?
NoSQL on microsoft azure april 2014
NoSQL on microsoft azure april 2014
Brian Benz
?
Ad

OLX-Tech-Talk

  • 1. Tech Talk Friday, 13 February 2015
  • 2. Create a RESTful API Express +
  • 3. Roadmap ? Express Overview ? MongoDB Overview ? Learn Express Route ? ODM MongoDB with Mongoose ? Handle CRUD for an item ? Use the proper HTTP verbs to make it RESTful (GET, POST, PUT, and DELETE) ? Return JSON data
  • 4. Getting Started $ curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash $ source ~/.nvm/nvm.sh $ nvm install v0.10.36 $ nvm alias default 0.10.36 Install and Setup Install Node.JS using NVM [Node Version Manager] https://github.com/creationix/nvm Install MongoDB on OS X Install MongoDB with Homebrew : $ brew install mongodb http://www.mongodbspain.com/en/2014/11/06/install-mongodb-on-mac-os-x-yosemite/
  • 5. MongoDB MongoDB is a document database that provides high performance, high availability, and easy scalability. source : http://www.mongodb.org/about/introduction/ Schema Less Data strore in JSON-like documents with dynamic Providing ?exibity during the development process Built-in Javascript :)
  • 7. ¡°Representational State Transfer (REST) is a software architecture style consisting of guidelines and best practices for creating scalable web services. REST is a coordinated set of constraints applied to the design of components in a distributed hypermedia system that can lead to a more performant and maintainable architecture.¡± http://en.wikipedia.org/wiki/Representational_state_transfer What is REST
  • 8. Express Apps $ npm install $ node server.js
  • 9. Express Route curl -i -X POST -H 'Content-Type: application/json' -d '{}' http://localhost:3000/user curl -i -X PUT -H 'Content-Type: application/json' -d '{}' http://localhost:3000/user curl -i -X DELETE -H 'Content-Type: application/json' -d '{}' http://localhost:3000/user curl -i -X GET http://localhost:3000/user
  • 10. MongoDB with MongooseJS $ npm install ¡ªsave mongoose
  • 12. $ git clone git@github.com:aredo/express-rest-api.git Source Code