nodejs lesson1

Download NODEjs Lesson1

Post on 25-May-2015

201 views

Category:

Technology

3 download

Embed Size (px)

TRANSCRIPT

  • 1. Lesson 1 By BigQ

2. Content What is Node.js Introduction Write and Run the Node.js HelloWorld Build a Website Build a basic HTTP server Build an index 3. Node.js ? PHP, Python, and Ruby JavaScript 4. Node.js ? PHP, Python, and Ruby JavaScript 5. Introduction JavaScript programming environment Use V8 runtime Event Driven Non-blocking libraries Supports CommonJS module format Supports C/C++ base add-ons 6. Write and Run the Node Node 7. Hello world! 1. console.log('Hello World'); helloworld.js 2.Node.js Command prompt node helloworld.js 8. Hello world! Hellow World 9. Build a WebsiteFirst We need a HTTP server !! 10. Build a basic HTTP servernodehttp(require) setverlisten 3000 11. Build a basic HTTP server(200)HTTP (Content-Type) response.write() HTTP "Hello World" response.end() 12. Build a basic HTTP server 1.Node.js2. localhost:3000 13. Build a basic HTTP server onRequest onRequestRequest received. httpServer has started. 14. Build a basic HTTP server (request) 15. Build a basic HTTP server serverserver.js requireserver ! 16. Build an Indexstart start 17. Build an Index server.jsindex.jsserverindex.js server.jsserverstart 18. Build an Index server.js index.jsserver.jsserverindex !