nodejs - building a restful api

27
SOFTWARE DEVELOPMENT CORPORATION (OSD) Building a RESTful API and Deploy to Cloud

Upload: sang-cu

Post on 15-Jan-2015

346 views

Category:

Technology


6 download

DESCRIPTION

 

TRANSCRIPT

SOFTWARE DEVELOPMENT CORPORATION (OSD)

Building a RESTful APIand

Deploy to Cloud

About Me

Sang CùImageware ASSkype: sangcn

WHY

Build fast and

Scalable

Success Stories

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/

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

Success Stories

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

Success Stories

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.

Success Stories

Ref: http://www.slideshare.net/joemccann/the-business-case-for-node

CPU Utilization hovered around 1%.

Developers “were bored” that day.

Agenda

Application Stack

Deployment Stack

Configurations

Routing

Authentication/Authorization

Testing

Deployment

Monitoring

Application Stack

RESTful API

ExpressJS

Mongoose

MongoDB Memory Caching

Controller

Key-Value Handler

Deployment Stack

Nodejs App

Github

Heroku – Cloud Application Platform

Travis

Configuration

Developing Mode Production Mode

Routing

ExpressJS – Web application framework for Node

Routing

ExpressJS – Web application framework for Node

Authentication

Create a middleware for Expressjs

Testing

Testing

• Config package.json

• make test

• Setup multi testing environment

Process.env.NODE_ENV = “(environment name)”

Testing

Deployment

Demo

Monitoring

NewRelic for Node

Monitoring

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/

SOFTWARE DEVELOPMENT CORPORATION (OSD)

QnA