0

I registered a simple domain name for testing on the dot.tk site.

Let it be called mysite.tk.

I have an application under node.js for simplicity like "Hello World!"

var express = require('express');

var app = express()
var server = require('http').createServer(app);

app.get('/', function(req, res) {
   res.send('Hello World!')
});
server.listen(3000, function () {
   console.log('Port 3000!')
});

On the local server, everything works. That is, on localhost: 3000 one shows "Hello World".

Question: how do I bind my new mysite.tk domain and my server on the computer?

I know that by default when mapping a domain name to an IP address, all traffic should come to port 80. I do not know, maybe this is the problem. I just use another port 3000 here. Maybe I sould run a proxy server written in node.js that will forward traffic correctly? But how it make?

This solution How to assign a domain name to node.js server? I don't understand enough. It did't help me.

  • 2
    You need to listen on port 80. – SLaks Oct 17 '17 at 20:29
  • On dot.tk login and get into manage your domain ... Manage DNS ... Add type A record to define your IP to your new domain ... On your local machine run ... dig mysite.tk ... to view mapping BTW your domain and the IP address ... This confirms A record has propagated ... Re-read that link ... Do research on unknown phrases ... We have all had to stumble through this exact question – Scott Stensland Oct 17 '17 at 20:44

1 Answers1

0

Just change your port number from 3000 to 80

Question: how do I bind my new mysite.tk domain and my server on the computer?

Your computer will be connected to internet by dynamic IP so you cant make your computer as server. If you really wanted to host application on your computer you need to purchase Static IP from your ISP.

Temporary solution is by creating an account in https://www.noip.com/free . It will provide a domain(somerandom.noip.com) and a tool(utility) that will map your dynamic ip to that domain(somerandom.noip.com). so that you can redirect mysite.tk to that domain (somerandom.noip.com).

Simple Solution is to go with https://ngrok.com/

Ranjithkumar MV
  • 804
  • 8
  • 10