-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
33 lines (23 loc) · 726 Bytes
/
Copy pathserver.js
File metadata and controls
33 lines (23 loc) · 726 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
/**
* @author NSSPA-CLI
* @email manuelc.p.g@gmail.com
*/
const express = require('express');
const app = express();
const path = require('path');
const port = process.env.PORT || 3030;
const server = require('http').Server(app);
const access = "/index.html";
const dist_dir = "<rootFolder>/dist/<appName>";
app.use(express.static(__dirname + dist_dir));
server.listen(port, function() {
console.log("App running on port " + port);
console.log("Current dir: "+__dirname + dist_dir);
})
// PathLocationStrategy
app.get('', function(req, res) {
res.sendFile(path.join( __dirname + dist_dir + access ));
});
app.get('/', function(req, res) {
res.sendFile(path.join( __dirname + dist_dir + access ));
});