Total Pageviews

Sunday 14 October 2018

NodeJS - Setup a HTTP / Local Web Server using custom port

We can run our web application on custom port which can be provided by the developer, here we can check that that the provided port is working on not.

Pre-requiste Installation
NodeJS

1.     Install npm install express
2.     Create server.js file
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/www'));
app.listen('3000');
console.log('working on 3000');
3.     In parallel root folder, create www folder
4.     Put index.html or application folder inside www folder, refer below image: 
      


5. Start server by typing node server.js in command prompt.

6. open     localhost:3000 and index.html code will execute.

Happy Coding :)



9 comments:

  1. Thanks for such a nice words :) Web Hosting in Pakistan

    ReplyDelete
  2. Thanks for such a nice words :) Web Hosting in Malaysia

    ReplyDelete
  3. Thanks, foг ones marvelous posting! I genuinely enjoyed reading it, you miggһt Ƅe a great author. I wiⅼl made certain to booҝmark your blog and ѡill often come back sometime soon. I want to encoᥙrage yourself to continue your great job, have a nice evening!
    Web Development Course
    best web development courses
    web development classes
    web development course near me
    Web Development Training
    training on web development
    web development training program
    web development training course
    web development summer training

    ReplyDelete
  4. This is why it is better that you should linked review before developing. It is possible to post superior send that way. Logo Designer

    ReplyDelete
  5. thue hosting Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though.

    ReplyDelete
  6. Regular visits listed here are the easiest method to appreciate your energy, which is why why I am going to the website everyday, searching for new, interesting info. Many, thank you! Ceh training

    ReplyDelete

Microsoft Logo using flexbox and Reactjs

 <!DOCTYPE html> <html> <head>     <script src="https://unpkg.com/react@18/umd/react.development.js" crossori...