Node js Sample Application
Node is a very popular JavaScript runtime for create the REST API and web application very quick, which developed by Ryan Dahl.
Open source
Support on all platform like (Windows, Linux, Unix, Mac etc.)
Use a JavaScript which is execute on server using chrome v8 engine.
Easy to setup development environment
Easy to deploy on Server
Run on a single-threaded, non-blocking, asynchronously programming, which is use very low memory.
Steps to create the first "Hello Work" Application
- Install Node JS on your system (https://nodejs.org/en/download/)
- Open terminal or command prompt
- Run command "npm init"
- Complete all the steps
- Create the index.js file and copy and paste sample
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World!'); }).listen(5000);
Start your web browser, and type in the address: http://localhost:5000
You can see the result and render the page with string "Hello world!"
In Next Article, I will create the web server which is handle the multiple page and API on one server.
Comments (0)
Post a Comment
Cancel