-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (22 loc) · 843 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
26
27
28
29
30
31
32
//Install express server
const express = require('express');
const path = require('path');
const app = express();
const stripe = require("stripe")('sk_test_51LAz4KC9WWOmeUQqrPNjR1MoMg8QUwat6VjKu7criZO85933G7zghbRiOZl4u6L8aY4VetIlnUEkxANmg24K018D000U1euugz');
const cors = require('cors');
// Serve only the static files form the dist
// directory
const corsOptions = {
allowedHeaders: ["Origin", "Content-Type", "Accept", "Authorization"],
origin: "*",
methods: "GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE",
preflightContinue: false,
};
app.use(cors(corsOptions));
app.use(express.static(__dirname + '/build'));
app.get('/*',
function (req, res) {
res.sendFile(path.join(__dirname + '/build/index.html'));
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);