Prateek Agarwal Prateek Agarwal - 2 months ago 20
Javascript Question

What the best way to deploy javascript based web app?

I'm a j2ee developer and till now I've deployed web apps in Tomcat, Weblogic and many App Servers, which were completely j2ee based.

Now I'm developing a Javascript based app that uses require js for module, QuickBlox and Firebase JS.

Now what are my options to deploy them so that a user can use them for chatting purpose like via www.chatapp.com

We are using Amazon's cloud platform EC2(I'm new to it).

Answer

From my experience, NodeJS is the way to go if your application will be a Single-page application. NodeJS will give you the ability to manipulate your application on the fly in the server side with pure JavaScript if necessary.

To start with, you can use ExpressJS to serve your files. From ExpressJS documentation:

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
})

The app starts a server and listens on port 3000 for connections.

Read the ExpressJS docs for more information. There is a lot of ways to serve files in NodeJS. You can search for more in npmjs.com