-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathserver.js
More file actions
34 lines (25 loc) · 814 Bytes
/
server.js
File metadata and controls
34 lines (25 loc) · 814 Bytes
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
28
29
30
31
32
33
34
const express = require('express');
const morgan = require('morgan');
const path = require('path');
const DEFAULT_PORT = process.env.PORT || 6420;
// initialize express.
const app = express();
// Configure morgan module to log all requests.
app.use(morgan('dev'));
// Setup app folders.
app.use(express.static('App'));
// Set up a route for signout.html
app.get('/signout', (req, res) => {
res.sendFile(path.join(__dirname + '/App/signout.html'));
});
app.get('/redirect', (req, res) => {
res.sendFile(path.join(__dirname + '/App/redirect.html'));
});
// Set up a route for index.html
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + '/index.html'));
});
app.listen(DEFAULT_PORT, () => {
console.log(`Sample app listening on port ${DEFAULT_PORT}!`)
});
module.exports = app;