SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Jakarta JS
Back to Basic of Node.js and Reactivity
RESTful API with Node.js + MongoDB
About Me
• Name : Sofian Hadiwijaya
• Email : me@sofianhw.com
• Blog : http://www.sofianhw.com
• Id : sofianhw
Basic - RESTful
Wikipedia, that infallible source, defines
Representational State Transfer (REST) as: an
architectural style that abstracts the architectural
elements within a distributed hypermedia system.
Basic - RESTful
Four basic design principles from IBM's developerWorks website
1.Use HTTP methods explicitly
2.Be Stateless
3.Expose directory structure-like URIs
4.Transfer XML or JSON, or Both
Basic - Express JS
A minimal and flexible node.js web application framework, providing a
robust set of features for building full web applications and/or APIs.
$ npm install express
• Middleware
• Routing
Basic - Express
Express Hello World
Basic - Express
A router object is an isolated instance of middleware and routes,
capable only of performing middleware and routing functions.
A router behaves like middleware itself, so you can use it as an
argument to app.use() or as the argument to another router’s use()
method.
Every Express application has a built-in app router:
Basic - Express
Chainable route handlers for a route path can be created using app.route().

Since the path is specified at a single location, it helps to create modular
routes and reduce redundancy and typos.
Basic - Mongoose
elegant mongodb object modeling for node.js
$ npm install mongoose
Build Basic RESTful
Very simple file structure
Defining Node Packages
Build Basic RESTful
Clone repository
$ git clone https://github.com/sofianhw/simple-restful-nodejs.git
Install packages with
$ npm install
Running Script
$ npm start
Model
Routes
Basic Testing - Mocha
Mocha is a simple, flexible, fun JavaScript test framework for node.js and
the browser.
$ npm install -g mocha
Basic Testing - Should
should is an expressive, readable, framework-agnostic assertion library. The
main goals of this library are to be expressive and to be helpful. It keeps your test
code clean, and your error messages helpful.
$ npm install should
Basic Testing - Supertest
HTTP assertions made easy via super-agent
$ npm install supertest

Contenu connexe

Tendances

Advance java session 20
Advance java session 20Advance java session 20
Advance java session 20Smita B Kumar
 
Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express jsAhmed Assaf
 
Shipping your logs to elk from mule app/cloudhub part 3
Shipping  your logs to elk from mule app/cloudhub  part 3Shipping  your logs to elk from mule app/cloudhub  part 3
Shipping your logs to elk from mule app/cloudhub part 3Alex Fernandez
 
Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15Smita B Kumar
 
Introduction To Mule
Introduction To MuleIntroduction To Mule
Introduction To MuleRoy Prins
 
Ch. 13 filters and wrappers
Ch. 13 filters and wrappersCh. 13 filters and wrappers
Ch. 13 filters and wrappersManolis Vavalis
 
Consume wsa
Consume wsaConsume wsa
Consume wsamahe797
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo javeed_mhd
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukLohika_Odessa_TechTalks
 
Mule properties
Mule propertiesMule properties
Mule propertiesGandham38
 
Mule concepts transformers
Mule concepts transformersMule concepts transformers
Mule concepts transformerskunal vishe
 
MuleSoft ESB Scripting Example
MuleSoft ESB Scripting ExampleMuleSoft ESB Scripting Example
MuleSoft ESB Scripting Exampleakashdprajapati
 

Tendances (20)

Mule quartz
Mule quartz Mule quartz
Mule quartz
 
Advance java session 20
Advance java session 20Advance java session 20
Advance java session 20
 
Mule: Java Transformer
Mule: Java TransformerMule: Java Transformer
Mule: Java Transformer
 
Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express js
 
Shipping your logs to elk from mule app/cloudhub part 3
Shipping  your logs to elk from mule app/cloudhub  part 3Shipping  your logs to elk from mule app/cloudhub  part 3
Shipping your logs to elk from mule app/cloudhub part 3
 
Advance java session 15
Advance java session 15Advance java session 15
Advance java session 15
 
Introduction To Mule
Introduction To MuleIntroduction To Mule
Introduction To Mule
 
Ch. 13 filters and wrappers
Ch. 13 filters and wrappersCh. 13 filters and wrappers
Ch. 13 filters and wrappers
 
Consume wsa
Consume wsaConsume wsa
Consume wsa
 
Mule technologies
Mule technologiesMule technologies
Mule technologies
 
XMPP Academy #2
XMPP Academy #2XMPP Academy #2
XMPP Academy #2
 
2 Basics
2 Basics2 Basics
2 Basics
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
 
Enabling Security For ActiveMQ JMX Access
Enabling Security For ActiveMQ JMX AccessEnabling Security For ActiveMQ JMX Access
Enabling Security For ActiveMQ JMX Access
 
Test
TestTest
Test
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys Serdiuk
 
Mule: Java Component
Mule: Java ComponentMule: Java Component
Mule: Java Component
 
Mule properties
Mule propertiesMule properties
Mule properties
 
Mule concepts transformers
Mule concepts transformersMule concepts transformers
Mule concepts transformers
 
MuleSoft ESB Scripting Example
MuleSoft ESB Scripting ExampleMuleSoft ESB Scripting Example
MuleSoft ESB Scripting Example
 

En vedette

Developing Virtual Reality Content
Developing Virtual Reality ContentDeveloping Virtual Reality Content
Developing Virtual Reality ContentSofian Hadiwijaya
 
IoT Presentation - Unsri - Palembang
IoT Presentation - Unsri - PalembangIoT Presentation - Unsri - Palembang
IoT Presentation - Unsri - PalembangSofian Hadiwijaya
 
ES 6 - Jakarta Javascript Meetup
ES 6 - Jakarta Javascript MeetupES 6 - Jakarta Javascript Meetup
ES 6 - Jakarta Javascript MeetupSofian Hadiwijaya
 
IoT Platform with MQTT and Websocket
IoT Platform with MQTT and WebsocketIoT Platform with MQTT and Websocket
IoT Platform with MQTT and WebsocketSofian Hadiwijaya
 
Machine Learning and Internet of Things
Machine Learning and Internet of ThingsMachine Learning and Internet of Things
Machine Learning and Internet of ThingsSofian Hadiwijaya
 

En vedette (12)

Web Analytics
Web Analytics Web Analytics
Web Analytics
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Realtime traffic monitoring
Realtime traffic monitoringRealtime traffic monitoring
Realtime traffic monitoring
 
Developing Virtual Reality Content
Developing Virtual Reality ContentDeveloping Virtual Reality Content
Developing Virtual Reality Content
 
IoT Presentation - Unsri - Palembang
IoT Presentation - Unsri - PalembangIoT Presentation - Unsri - Palembang
IoT Presentation - Unsri - Palembang
 
ES 6 - Jakarta Javascript Meetup
ES 6 - Jakarta Javascript MeetupES 6 - Jakarta Javascript Meetup
ES 6 - Jakarta Javascript Meetup
 
Docker 101 for Developer
Docker 101 for DeveloperDocker 101 for Developer
Docker 101 for Developer
 
IoT Platform with MQTT and Websocket
IoT Platform with MQTT and WebsocketIoT Platform with MQTT and Websocket
IoT Platform with MQTT and Websocket
 
Pre-Hackathon FinTech - DBS
Pre-Hackathon FinTech - DBSPre-Hackathon FinTech - DBS
Pre-Hackathon FinTech - DBS
 
Machine Learning and Internet of Things
Machine Learning and Internet of ThingsMachine Learning and Internet of Things
Machine Learning and Internet of Things
 
Minimum viable product
Minimum viable productMinimum viable product
Minimum viable product
 
Intro to Big Data - Spark
Intro to Big Data - SparkIntro to Big Data - Spark
Intro to Big Data - Spark
 

Similaire à Javascript Basic RESTful

Similaire à Javascript Basic RESTful (20)

ExpressJS-Introduction.pdf
ExpressJS-Introduction.pdfExpressJS-Introduction.pdf
ExpressJS-Introduction.pdf
 
Expo Router V2
Expo Router V2Expo Router V2
Expo Router V2
 
Node JS | Dilkash Shaikh Mahajan
Node JS | Dilkash Shaikh MahajanNode JS | Dilkash Shaikh Mahajan
Node JS | Dilkash Shaikh Mahajan
 
Building Killer RESTful APIs with NodeJs
Building Killer RESTful APIs with NodeJsBuilding Killer RESTful APIs with NodeJs
Building Killer RESTful APIs with NodeJs
 
ExpressJS and REST API.pptx
ExpressJS and REST API.pptxExpressJS and REST API.pptx
ExpressJS and REST API.pptx
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Mean PPT
Mean PPTMean PPT
Mean PPT
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN Stack
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
Meanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore ChandraMeanstack Introduction by Kishore Chandra
Meanstack Introduction by Kishore Chandra
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Meanstack overview
Meanstack overviewMeanstack overview
Meanstack overview
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 
MEAN Stack
MEAN StackMEAN Stack
MEAN Stack
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?
 
Top 10 frameworks of node js
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node js
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 

Plus de Sofian Hadiwijaya (20)

Workshop Web3 Weekend Social Impact
Workshop Web3 Weekend Social ImpactWorkshop Web3 Weekend Social Impact
Workshop Web3 Weekend Social Impact
 
Warung Pintar Social Impact Report 2018
Warung Pintar Social Impact Report 2018Warung Pintar Social Impact Report 2018
Warung Pintar Social Impact Report 2018
 
Agile and Scrum 101
Agile and Scrum 101Agile and Scrum 101
Agile and Scrum 101
 
Execute Idea
Execute Idea Execute Idea
Execute Idea
 
Product market fit and Scale
Product market fit and ScaleProduct market fit and Scale
Product market fit and Scale
 
Entrepreneur Story
Entrepreneur StoryEntrepreneur Story
Entrepreneur Story
 
Pathway became data scientist
Pathway became data scientistPathway became data scientist
Pathway became data scientist
 
Keynote Speaker PyConID 2018
Keynote Speaker PyConID 2018Keynote Speaker PyConID 2018
Keynote Speaker PyConID 2018
 
Building Startups
Building StartupsBuilding Startups
Building Startups
 
Big data and digital marketing
Big data  and digital marketingBig data  and digital marketing
Big data and digital marketing
 
Data Driven Organization
Data Driven OrganizationData Driven Organization
Data Driven Organization
 
Data Driven Company
Data Driven CompanyData Driven Company
Data Driven Company
 
serverless web application
serverless web applicationserverless web application
serverless web application
 
Startup 101
Startup 101Startup 101
Startup 101
 
IoT and AI for Retail Industry
IoT and AI for Retail IndustryIoT and AI for Retail Industry
IoT and AI for Retail Industry
 
Growth in Startup
Growth in StartupGrowth in Startup
Growth in Startup
 
Technology Industry
Technology Industry Technology Industry
Technology Industry
 
What you can get with data
What you can get with dataWhat you can get with data
What you can get with data
 
DeepLearning with Neon
DeepLearning with NeonDeepLearning with Neon
DeepLearning with Neon
 
How BigData Affects Business
How BigData Affects BusinessHow BigData Affects Business
How BigData Affects Business
 

Dernier

Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 

Dernier (20)

Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 

Javascript Basic RESTful

  • 1. Jakarta JS Back to Basic of Node.js and Reactivity RESTful API with Node.js + MongoDB
  • 2. About Me • Name : Sofian Hadiwijaya • Email : me@sofianhw.com • Blog : http://www.sofianhw.com • Id : sofianhw
  • 3. Basic - RESTful Wikipedia, that infallible source, defines Representational State Transfer (REST) as: an architectural style that abstracts the architectural elements within a distributed hypermedia system.
  • 4. Basic - RESTful Four basic design principles from IBM's developerWorks website 1.Use HTTP methods explicitly 2.Be Stateless 3.Expose directory structure-like URIs 4.Transfer XML or JSON, or Both
  • 5. Basic - Express JS A minimal and flexible node.js web application framework, providing a robust set of features for building full web applications and/or APIs. $ npm install express • Middleware • Routing
  • 7. Basic - Express A router object is an isolated instance of middleware and routes, capable only of performing middleware and routing functions. A router behaves like middleware itself, so you can use it as an argument to app.use() or as the argument to another router’s use() method. Every Express application has a built-in app router:
  • 8. Basic - Express Chainable route handlers for a route path can be created using app.route().
 Since the path is specified at a single location, it helps to create modular routes and reduce redundancy and typos.
  • 9. Basic - Mongoose elegant mongodb object modeling for node.js $ npm install mongoose
  • 10. Build Basic RESTful Very simple file structure Defining Node Packages
  • 11. Build Basic RESTful Clone repository $ git clone https://github.com/sofianhw/simple-restful-nodejs.git Install packages with $ npm install Running Script $ npm start
  • 12. Model
  • 14. Basic Testing - Mocha Mocha is a simple, flexible, fun JavaScript test framework for node.js and the browser. $ npm install -g mocha
  • 15. Basic Testing - Should should is an expressive, readable, framework-agnostic assertion library. The main goals of this library are to be expressive and to be helpful. It keeps your test code clean, and your error messages helpful. $ npm install should
  • 16. Basic Testing - Supertest HTTP assertions made easy via super-agent $ npm install supertest