DEVELOPING RESTFULL APIS WITH NODEJS

"ONE LANGUAGE TO CONQUER THEM ALL"

ERICK WENDEL

MICROSOFT STUDENT PARTNER

​​

what is nodejs ?

node.js

"...development platform built on top of Google's V8 JavaScript virtual machine. The Node.js libraries are focused on building server-side applications in JavaScript."

v8

"...V8 is the JavaScript execution engine built for Google Chrome and open-sourced by Google in 2008. Written in C++, V8 compiles JavaScript source code to native machine code instead of interpreting it in real time"

the node.js system

confused ?

demonstration

hello world

what problem it solves ?

when use nodejs

  • Intensive I/O 
  • Web Applications
  • Chat
  • Data Streaming

when not use nodejs

  • Parallel Applications
  • Heavy Server-side computation / processing
  • Intensive CPU operations

building apis with hapi.js

hapi.js

demonstration

hapi.js

joi

npm i --save hapi
npm i --save joi

demonstration

hapi.js

jwt

Hapi Auth using JSON Web Tokens (JWT)

Hapi Auth using JSON Web Tokens (JWT)

npm i --save hapi      
npm i --save hapi-auth-jwt2    //manage token on hapi lifecycle
npm i --save jsonwebtoken      //sign and validation

demonstration

hapi.js

swagger

HAPI SWAGGER

npm i --save hapi      
npm i --save joi           //object validations
npm i --save inert         //Static file and directory handler
npm i --save vision        //Templates rendering
npm i --save hapi-swagger  //API Documentation

demonstration

OBRIGADO !!!

  • http://bit.ly/control-flow-nodejs

  • http://bit.ly/mva-erickwendel

  • http://erickwendel.com.br

  • http://netcoders.com.br/blog​

  • http://slides.com/erickwendel/restfull-apis-com-nodejs/live#/

  • https://github.com/ErickWendel/palestra-impacta/

mais links

  • https://nodejs.org/en/about/

  • https://en.wikipedia.org/wiki/Node.js

  • http://stackoverflow.com/questions/21596172/what-function-gets-put-into-eventloop-in-nodejs-and-js

  • https://github.com/hapijs/joi/blob/v9.1.0/API.md

  • https://github.com/dwyl/hapi-auth-jwt2

  • https://github.com/ryanfitz/hapi-auth-jwt

  • http://hapijs.com/plugins