Introduction To Node - Js
Introduction To Node - Js
js
About Node.js
• Created by Ryan Dahl in 2009
• MIT License
● Libevent => C
• Ideal for applications that serve a lot of requests but dont use/need lots of computational power
per request
• Avoid synchronous code at all costs because it blocks the event loop
● Web application
● Websocket server
● Ad server
● Proxy server
● Streaming server
● Fast file upload client
● Any Real-time data apps
● Anything with high I/O
Application of node.js
• NodeJS should be preferred to build Real-Time
Chats, Complex Single-Page applications, Real-
time collaboration tools, Streaming apps, JSON
APIs based application.
• There are some frameworks of the node which you
can use to build your applications. Some popular
frameworks of node are…Express.js, Socket.io,
Koa.js, Meteor.js, Sail.js.
The Built-in HTTP module
Node.js has a built-in module called HTTP,
which allows Node.js to transfer data over the
Hyper Text Transfer Protocol (HTTP).
To include the HTTP module, use the require()
method:
To include a module in a node.js application use the require() function with the
parenthesis containing the name of the module.