Reputation: 1440
I know to build a basic HTTP server in Node with Express, all I need is this code:
var http = require('http');
var express = require('express');
var app = express();
var server = http.createServer(app);
server.listen(1234);
console.log('HTTP server listening on port: $d',server.address().port);
And then I can:
curl http://123.45.67.89:1234
and get a reponse back.
My question: instead of the URL:PORT being my homepage, is it a domain controller or my node/express application that allows my home page to be:
http://mywebsite
or
http://mywebsite/somestuff
?
Thanks!
Upvotes: 0
Views: 1694
Reputation: 99
You need to buy a web server with the domain name "mywebsite". So it is controlled by the domain controller.
"http://" is obviously the protocol being used by the server.
"mywebsite" is your website domain name and is not controlled by node.
".com" is the top-level domain also not controlled by node.
"/somestuff" is controlled by node.
So to get a website that looks like this http://mywebsite.com/somestuff. You need to buy the domain "mywebsite" and choose the top-level domain "com", this can be done from any company offering web servers. The only thing you can control with node is "/somestuff". Everything after the domain name and top-level domain is controlled by you directly so it can be changed easy. The other stuff cant be changed after you bought the server. Well it can but then you have to buy a new domain....
Upvotes: 1