-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
45 lines (34 loc) · 1.13 KB
/
index.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const express = require('express');
const path = require('path');
const cors = require('cors');
const app = express();
const port = process.env.PORT || 8080;
app.use(cors({
origin: true,
optionSuccessStatus:200
}));
// sendFile will go here
app.get('/', function(req, res) {
res.redirect('/home');
});
app.get('/login', function(req, res) {
res.sendFile(path.join(__dirname, '/src/html/connection.html'));
});
app.use('/css', express.static(path.join(__dirname, 'src/css')));
app.use('/js', express.static(path.join(__dirname, 'src/js')));
app.use('/assets', express.static(path.join(__dirname, 'src/assets')));
app.use('/modules', express.static(path.join(__dirname, 'node_modules')));
app.get('/home', function(req, res) {
res.sendFile(path.join(__dirname, '/src/html/home.html'));
});
app.get('/import', function(req, res) {
res.sendFile(path.join(__dirname, '/src/html/import.html'));
});
app.get('/export/', function(req, res) {
res.sendFile(path.join(__dirname, '/src/html/export.html'));
});
app.get('/recap', function(req, res) {
res.sendFile(path.join(__dirname, '/src/html/recap.html'));
});
app.listen(port);
module.exports = app;