1

i am trying to url in node.js project

currently show in my local server port like -http://localhost:1337 expected url =http://localhost:1337/nodeprovider

var http = require('http');
var port = process.env.port || 1337;
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Hello World\n');
}).listen(port);
Dip Girase
  • 439
  • 1
  • 7
  • 18

2 Answers2

0

If I understood you right: you need your node.js server to response on http://abcwebsite /nodeprovider

Since this that task must be done not in Node.js server I suggest you to read about domain parking: https://en.wikipedia.org/wiki/Domain_parking

Making long thing short: Node.js server is not responsible for domain name it responds on. Inside server script you can only set port to listen.

  • i am trying to mvc4 project and another node.js project in one solution so how to possible to call this node.js project – Dip Girase Dec 21 '18 at 06:46
0

From an old answer

You dont assign a domain to a node.js server, instead you load your app onto a machine which has an ip adress. You then need to make sure your app is listening on the correct port, which on most servers is 80.

now getting a domain name to point to this ip adress is an entirely separate matter. You need to make your name server point to the ip. Your name server will usually be the company you bought the domain name through, for instance GoDaddy is a Domain Name Server (DNS). So if you had a domain name with them, you would go on their site under DNS settings and change the ip adress. Your domain name will then point to your ip adress and should render your node.js app.

Community
  • 1
  • 1