Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create a server in Node.js

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 461
    Comment on it

    Hello Readers.

    Node.js is very popular in market in creating of real time applications.Here's the example of how we can create the server in our local system to run the Node.js applications.

      var http = require('http')
          , static = require('node-static')
          , server;
    
        // since socket.io 0.7 consumes one socket we need another socket to transmit all static files from ./public dir
        server = http.createServer(function(req, res){
        req.addListener('end', function () {
        file.serve(req, res);
        }).resume();
    }).listen(8081);
    

    where 8081 is the port number to run the application.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: