Create basic server

This commit is contained in:
Jake Howard 2016-05-16 08:37:24 +01:00
parent e362ddc784
commit 8f0660040a
2 changed files with 23 additions and 0 deletions

2
.gitignore vendored
View file

@ -31,3 +31,5 @@ node_modules
# Optional REPL history
.node_repl_history
site/

21
server.js Normal file
View file

@ -0,0 +1,21 @@
const express = require('express');
const PORT = process.env.PORT;
const serveDir = __dirname + '/site/';
const expressConfig = {
dotfiles: 'deny',
index: false,
redirect: true
};
const app = express();
app.use(
express.static(serveDir, expressConfig)
);
const server = app.listen(PORT, function () {
const serverPort = server.address().port;
console.log('Server started on port ' + serverPort);
});