Skip to content

Commit a9444b8

Browse files
authored
Create server.js
1 parent c6858a4 commit a9444b8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

server.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
});

0 commit comments

Comments
 (0)