-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
56 lines (40 loc) · 1.31 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const express = require('express');
// import fetch from 'node-fetch';
// var bodyParser = require('body-parser');
// const { json } = require('body-parser');
const path = require('path');
const app = express();
// const cors = require('cors');
// app.use(cors());
// const fs = require('fs');
// var cloudinary = require('cloudinary').v2;
// cloudinary.config({
// cloud_name: 'undergroundnook',
// api_key: '197948958869879',
// api_secret: 'UDvL3l6lxXSHc6Xdk1hb_nWzDH8'
// });
const port = process.env.PORT || 3030;
// function uploadimg() {
// cloudinary.uploader.upload("zbALL.jpg",
// function(error, result) {console.log(result, error)});
// }
// uploadimg();
// console.log(options.cert);
// app.use(bodyParser.json());
// app.use(bodyParser.urlencoded({
// extended: true
// }));
app.use(express.json());
app.use(express.static(path.join(__dirname, '/client/build')));
const postRoutes = require("./routes/api");
app.use("/api", postRoutes);
app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, 'client', 'src', 'Pages', 'Home.js'));
})
app.listen(port, () => {
console.log(`Listening on *: ${port}`)
});
// Create an HTTP service.
// http.createServer(app).listen(3000);
// Create an HTTPS service identical to the HTTP service.
// https.createServer(options, app).listen(3000);