-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (21 loc) · 723 Bytes
/
Copy pathindex.js
File metadata and controls
27 lines (21 loc) · 723 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
const express = require("express");
const cors = require("cors");
const path = require("path");
const bodyParser = require("body-parser");
const path = require("path");
const app = express();
require("env2")("./config.env");
const pyReq = require("./helpers/python");
const dataReq = require("./helpers/dataFetch");
const PORT = process.env.PORT || 5000
//fetch to send data back to frontEnd
//const fetch()
app.use(express.static(path.join(__dirname, 'client/build')));
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, 'client/build', 'index.html'));
});
app.post("/react", dataReq);
app.listen(PORT);