THRIFT-4625: Use let/const variable decorators in ES6 Javascript
diff --git a/lib/js/test/server_http.js b/lib/js/test/server_http.js
index 1115474..d04f578 100644
--- a/lib/js/test/server_http.js
+++ b/lib/js/test/server_http.js
@@ -17,33 +17,39 @@
  * under the License.
  */
 
-//This HTTP server is designed to serve the test.html browser
+//  This HTTP server is designed to serve the test.html browser
 //  based JavaScript test page (which must be in the current directory).
 //  This server also supplies the Thrift based test service, which depends
 //  on the standard ThriftTest.thrift IDL service (which must be compiled
 //  for Node and browser based JavaScript in ./gen-nodejs and ./gen-js
 //  respectively).
+//
+//  Using the command flag --es6, this server can be run using nodejs code built
+//  for the es6 environment or for pre-es6 environment.
+//
 
-var thrift = require('../../nodejs/lib/thrift');
-var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
+const thrift = require('../../nodejs/lib/thrift');
+const es6Mode = process.argv.includes('--es6');
+const genFolder = es6Mode ? 'gen-nodejs-es6' : 'gen-nodejs';
+const ThriftTestSvc = require(`./${genFolder}/ThriftTest.js`);
+const ThriftTestHandler = require('./test_handler').ThriftTestHandler;
 
-var ThriftTestSvcOpt = {
+const ThriftTestSvcOpt = {
 	transport: thrift.TBufferedTransport,
 	protocol: thrift.TJSONProtocol,
 	processor: ThriftTestSvc,
 	handler: ThriftTestHandler
 };
 
-var ThriftWebServerOptions = {
+const ThriftWebServerOptions = {
 	files: '.',
 	services: {
 		'/service': ThriftTestSvcOpt
 	}
 };
 
-var server = thrift.createWebServer(ThriftWebServerOptions);
-var port = 8088;
+const server = thrift.createWebServer(ThriftWebServerOptions);
+const port = es6Mode ? 8088 : 8089;
 server.listen(port);
-console.log('Serving files from: ' + __dirname);
-console.log('Http/Thrift Server running on port: ' + port);
+console.log(`Serving files from: ${__dirname}`);
+console.log(`Http/Thrift Server (ES6 mode ${es6Mode}) running on port: ${port}`);