I started learning node.js a couple weeks ago and just finished my first small project, a basic live chat website using socket.io and express. The structure for my project looks like this:
ChatApp
|
|____backend.js // node server side code
|
|____ static
| |
| |_____ libs
| |
| |___ app.js // front end logic
| |
| |___ jquery.min.js
|____ views
|
|_____ index.html // Client website
My goal right now is to learn how to use AWS to make my application available so people on different machines can talk to one another, not just me on my local server. I tried following this guide which uses Elastic Beanstalk to deploy a sample repository, but I'm having a hard time seeing how to translate it to my folder structure, since they don't even have an HTML for instance.
My server code looks like this:
//*****************//
// Sets up backend //
//*****************//
var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
var express = require('express');
server.listen(8080);
app.use(express.static(__dirname + '/views'));
app.use(express.static(__dirname + '/static'));
var users = [];
//*****************//
// Sends out html //
//*****************//
app.get('/', function(req, res){ // Main page
res.render('index.html');
});
//*************************//
// Handles socket requests //
//*************************//
io.on("connection", handleIO); // Called when user connects
function handleIO(socket){
console.log('Client connected...');
// Bunch of socket.io code I didn't think was necessary to add
}
Anyways, I was wondering if any of you enlightened folks could help a noob out with deploying his first website. If you could either give me a general outline or point me to one I'd really appreciate it as AWS can be pretty intimidating when first starting out. Thanks.