-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
24 lines (19 loc) · 773 Bytes
/
server.js
File metadata and controls
24 lines (19 loc) · 773 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
const express = require('express');
const path = require('path');
const app = express();
//Set headers for the requests
//----------------------------------------------------------
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", '*');
res.header("Access-Control-Allow-Credentials", true);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header("Access-Control-Allow-Headers", 'Origin,X-Requested-With,Content-Type,Accept,Authorization,content-type,application/json');
next();
});
// Start the server
app.listen(process.env.PORT || '8080', () => {
console.log("App running on localhost:8080");
});
var distDir = __dirname + "/dist/";
app.use(express.static(distDir));
module.exports = app;