SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,106
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Post problem in installing

    Hi, I need some help please i am downloading the node.js installer in the site and run it in my laptop windows 7,after successfully installed.i click the node.js in my startmenu and the command prompt opened..I don't know what to do next...by the way how do i make the node js to listen in other port not in 80 or 8080 so that my wampserver can still be accessible.


    Thank you in advance

  2. #2
    SitePoint Member davidclark's Avatar
    Join Date
    Apr 2014
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nodejs is a programming language. To get nodejs listen a port you can follow this example. Let 's create file ex.js

    Code:
    var http = require('http');
    http.createServer(function (req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Hello World\n');
    }).listen(1337, '127.0.0.1');
    console.log('Server running at http://127.0.0.1:1337/');
    Then open command prompt and execute this

    Code:
    # node ex.js
    Then try to access http://127.0.0.1:1337 to see the result.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •