Nodejs - Building a RESTful API

461
-1

Published on

Published in: Technology

Nodejs - Building a RESTful API

  1. 1. SOFTWARE DEVELOPMENT CORPORATION (OSD) Building a RESTful API and Deploy to Cloud
  2. 2. About Me Sang Cù Imageware AS Skype: sangcn
  3. 3. WHY Build fast and Scalable
  4. 4. Success Stories
  5. 5. Success Stories Built a Node version of a Java app half the time with fewer developers to Ref: https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/
  6. 6. Success Stories “Velocity was the key driving point for PayPal's move to Node. We found it enabled a huge boost to our workflow allowing us to iterate faster and innovate more.” –Jeff Harrel, Director of User Interface Engineering
  7. 7. Success Stories
  8. 8. Success Stories Easily serving 50,000 requests/minute Handling the same amount of traffic as before but with less hardware. Ref: http://www.slideshare.net/joemccann/the-business-case-for-node
  9. 9. Success Stories
  10. 10. Success Stories Ref: http://www.slideshare.net/joemccann/the-business-case-for-node 55% of all traffic on Black Friday went to Node servers. Not a single Node server went down. Zero.
  11. 11. Success Stories Ref: http://www.slideshare.net/joemccann/the-business-case-for-node CPU Utilization hovered around 1%. Developers “were bored” that day.
  12. 12. Agenda  Application Stack  Deployment Stack  Configurations  Routing  Authentication/Authorization  Testing  Deployment  Monitoring
  13. 13. Application Stack RESTful API ExpressJS Mongoose MongoDB Memory Caching Controller Key-Value Handler
  14. 14. Deployment Stack Nodejs App Github Heroku – Cloud Application Platform Travis
  15. 15. Configuration Developing Mode Production Mode
  16. 16. Routing ExpressJS – Web application framework for Node
  17. 17. Routing ExpressJS – Web application framework for Node
  18. 18. Authentication Create a middleware for Expressjs
  19. 19. Testing
  20. 20. Testing • Config package.json • make test • Setup multi testing environment Process.env.NODE_ENV = “(environment name)”
  21. 21. Testing
  22. 22. Deployment Demo
  23. 23. Monitoring NewRelic for Node
  24. 24. Monitoring
  25. 25. Reference 1. Nodejs - http://nodejs.org/ 2. Expressjs - http://expressjs.com/ 3. MongoDB - https://www.mongodb.org/ 4. Mongoose –mongoosejs.com 5. Request - https://www.npmjs.org/package/request 6. Es6-Promise - https://www.npmjs.org/package/es6-promise 7. NewRelic - http://newrelic.com/application-monitoring 8. Travis CI - https://travis-ci.org/ 9. Heroku Cloud - https://www.heroku.com/
  26. 26. SOFTWARE DEVELOPMENT CORPORATION (OSD)

×