I am going to preface this by saying I am very new to working with servers and my question may struggle in presentation because of this.
I am currently trying to find a place to host a node server I wrote using node.js. I have been using express to actually deploy the server, using this command:
//Run the server
const { port, ipAddress } = SERVER_LOCATION;
const app = express();
const server = app.listen(port, ipAddress, DEBUG(debugTypes.ServerLog,
'HTTP://' + ipAddress + ':' + port));
//Host a page directly through the server for testing
var resOptions ={
root:__dirname + '/',
}
app.use('/', express.static(__dirname + '/public/'));
app.get('/', (req, res) => { res.sendFile('/index.html', resOptions); });
For testing, I have been using an ipAddress value of 127.0.0.1 and a port of 3000. When I go to http://127.0.0.1:3000/, I see my index.html page with no difficulties.
At this point, I am attempting to run this node server on an amazon ec2 instance. The instance is running and I am able to ssh into it with no difficult and see the console message that appears when I start the server. However, I have no idea how to use my web browser to connect to the index.html page. What do I need to configure in order to ensure I can access the page, and once I configure it, how do I load the page in a standard web browser?
via Matthew Fasman
No comments:
Post a Comment