File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change
1
+ // server.js: This is a tiny NodeJS web server hosting static files from the /www folder in the Elastic Beanstalk deployment ZIP
2
+ // Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
3
+ var express = require ( 'express' ) ;
4
+ // Let's create an instance of an express web server
5
+ var app = express ( ) ;
6
+ // By default, let's use port 80, unless we provide a different value as argument or system environment variable
7
+ var port = process . env . PORT || process . argv [ 2 ] || 80 ;
8
+ // Let's host all the static files in /www as root of our little web server
9
+ app . use ( '/' , express . static ( __dirname + '/www' ) ) ;
10
+ // Start listening on the desired port for incoming traffic
11
+ var server = app . listen ( port , function ( ) {
12
+ console . log ( 'listening on port:' , port ) ;
13
+ } ) ;
You can’t perform that action at this time.
0 commit comments