intro to http and node.js

12
Introduction to Jean-Luc David Head of Technology [email protected] Twitter: @jldavid

Upload: jean-luc-david

Post on 16-Apr-2017

260 views

Category:

Technology


0 download

TRANSCRIPT

Introduction to

Jean-Luc David Head of Technology [email protected]: @jldavid

Agenda• Introduction to Node.js • Introduction to cURL • Node.js Basics

Node.js vs PHP

Popularity - 89K+ NPM Packages

Companies Using Node.js

http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis

Consider Technology as a Swiss Army Knife

What is Node.js• Node.js is a software platform that is used to build

scalable network (especially server-side) applications.

• Utilizes JavaScript as its scripting language, and achieves high throughput via non-blocking I/O and a single-threaded event loop.

• Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd.

• Node.js is control.

- Hypertext Transfer Protocol - Web Browser - HTTP Client - Comprised of headers + body - Verbs: GET, PUT, POST, DELETE - GET http://www.doclermedia.com HTTP/1.0 - Demo: Using Charles & CURL

HTTP

cURL• cURL is a computer software project providing a library and

command-line tool for transferring data using various protocols. The cURL project produces two products, libcurl and cURL. It was first released in 1997.

• GET, POST, PUT & DELETE

curl -X GET http://www.google.com

node helloworld.js console.log("Hello World");

node server.js http_server = require("http"); http_server.createServer(function(request,response){ console.log("Launching Server"); response.writeHeader(200, {"Content-Type": "text/plain"}); response.write("Hello World"); response.end(); }).listen(8080); console.log("Server Running on 8080");