-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
28 lines (22 loc) · 824 Bytes
/
app.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
const express = require("express");
const app = express();
const bodyParser = require("body-parser");
const apiConceptNet = require("./routes/api/api_conceptnet.js");
const path = require("path");
const port = process.env.PORT || 5000;
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname,'frontend','dist')));
if (process.env.NODE_ENV === 'production') {
app.use(express.static('frontend/dist'));
app.get('/', (req, res) => {
res.sendFile(path.resolve(__dirname, 'frontend', 'dist', 'index.html'));
})
}
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/frontend/dist/index.html'));
});
app.use("/api/conceptnet", apiConceptNet);
app.listen(port, () => {
// console.log(`Server is running on port ${port}`)
});