Ehsan Ghanbari

Experience, DotNet, Solutions

Node.JS, Hello World!

I'm completely new in Node.JS, just read about it for the first time. Based on  wikipedia "Node.js is a server-side software system designed for writing scalable Internet applications, notably web servers. Programs are written on the server side in JavaScript, using event-driven, asynchronous I/O to minimize overhead and maximize scalability."

Node.js platform was created by Ryan Dahl starting in 2009. You can develop a real-time, two-way connection (client and server side) web-based application by NodeJS. It operates on a single thread and allows for thousands of concurrent connections so seems to be suitable for particular needs. NodeJs has a built-in HTTP server library and it enable to run a web server solely and it also uses event-driven and non-blocking I/O (unlike traditional web development tools and mechanisms) model which makes it suitable for real-time applications. As I mentioned NodeJS does not use traditional request/response (a thread for each of them), it just uses one thread by default (I don’t know enough about the built in architecture of it) so it supposed to be more famouse in the future as it covers lots of need.

But I'm interested to Share the first and most famous sample of every programming language here, take a look at "hello world" sample in NodeJS:

  1. var http = require('http');
  2. http.createServer(
  3.   function (request, response) {
  4.     response.writeHead(200, {'Content-Type': 'text/plain'});
  5.     response.end('Hello World\n');
  6.   }
  7. ).listen(8000);
  8. console.log('Server running at http://localhost:8000/');

At the first glance it's completely obvious that the JavaScript is base requirement for NodeJS.



About Me

Ehsan Ghanbari

Hi! my name is Ehsan. I'm a developer, passionate technologist, and fan of clean code. I'm interested in enterprise and large-scale applications architecture and design patterns. I spend a lot of time on software architecture. Since 2008, I've been as a developer for different companies and organizations and I've been focusing on Microsoft ecosystem all the time. During the past years, Read More

Post Tags
Pending Blog Posts
using Elmah in MVC4
Using FluentSecurity in MVC
Strategic design
Factory Pattern
time out pattern in ajax
Redis as a cache server
How to use PagedList In MVC
Multiple submit buttons in MVC
Domain driven design VS model driven architecture
What's the DDD-lite?
comments powered by Disqus