Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wiring API’s in Node.js

Wiring API’s in Node.js

Rahul Trikha

October 13, 2015
Tweet

More Decks by Rahul Trikha

Other Decks in Technology

Transcript

  1. What is REST? REST stands for ‘Representational State Transfer’ and

    it is an architectural pattern for creating an API that uses HTTP as its underlying communication method. Image: http://maxoffsky.com/code-blog/building-restful-api-in-laravel-start-here/
  2. What is REST? • Resources – REST uses addressable resources

    • Request Verbs – [GET, POST, PUT, DELETE] • Request Headers – These are additional instructions that are sent with the request. These might define what type of response is required or authorisation details. • Request Body - Typically sent as the request body in the format of JSON or XML. • Response Body – Returned by the API, this might be a JSON or XML document. • Response Status codes – These codes are issues with the response and give the client details on the status of the request.
  3. Popular REST API Examples • https://developer.github.com/v3/ • https://developers.google.com/maps/ • https://www.flickr.com/services/api/

    • https://dev.twitter.com/rest/public • https://www.twilio.com/docs/api/rest • https://developer.paypal.com/docs/api/ • https://stripe.com/docs/api#intro
  4. What is Node.js • Node.js is a JavaScript runtime built

    on Chrome's V8 JavaScript engine. • Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. • Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
  5. Why to use Node.js for API’s • Building light-weight REST

    / JSON api's is something where node.js really shines. • Its non-blocking I/O model combined with JavaScript make it a great choice for wrapping other data sources such as databases or web services and exposing them via a JSON interface.
  6. Strongloop • The StrongLoop API Platform features the popular open

    source LoopBack framework. LoopBack enables you to quickly compose scalable APIs, runs on top of the Express web framework and conforms to the Swagger 2.0 specification. • LoopBack is built on top of Express, the world’s most popular web framework for Node • Easily create REST API endpoints • Support for social logins via Passport.js • Swagger 2.0 Compliant