-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
27 lines (21 loc) · 757 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
* See LICENSE in the source repository root for complete license information.
*/
var express = require('express');
var app = express();
var morgan = require('morgan');
var path = require('path');
// Initialize variables.
var port = 30662; // process.env.PORT || 30662;
// Configure morgan module to log all requests.
app.use(morgan('dev'));
// Set the front-end folder to serve public assets.
app.use(express.static('JavaScriptSPA'))
// Set up our one route to the index.html file.
app.get('*', function (req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
});
// Start the server.
app.listen(port);
console.log('Listening on port ' + port + '...');