nodejs creating dns name for application

Hi I have node js application. I run it locally as :

http.createServer(processRequest).listen(1337);

To rich my application in browser I need to write: localhost:1337/index.html

So I have 2 questions:

  1. If I want to rich my application as www.myapp.dev/index.html instead of localhost:1337/index.html, what I need to change in my code?
  2. I bought domain www.myserver.com, what I need to put in my app in order to do it work in this domain?

Thanks.

  1. You need to change 1337 to 80 (technically you don't need to do that, you could run an proxy on port 80 instead).
  2. Nothing

Your app isn't paying attention to the Host header, so it doesn't matter what Host header the browser sends.

Outside the app you will need to configure your DNS to point the hostname at your IP address.