-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
25 lines (18 loc) · 800 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
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static('./dist/ibge-sql'));
app.use(function(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,content-type,application/json, authorization');
next();
});
app.get('/*', function(req,res) {
res.sendFile(path.join(__dirname,'/dist/ibge-sql/index.html'));
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);