no idea what i did
This commit is contained in:
+6
-3
@@ -1,10 +1,13 @@
|
||||
import express from "express";
|
||||
|
||||
import connectDB from "./config/db";
|
||||
|
||||
import path from "path";
|
||||
import cors from "cors";
|
||||
|
||||
const app = express();
|
||||
|
||||
// add cors otherwise fronend cannot access backedn
|
||||
app.use(cors());
|
||||
|
||||
connectDB();
|
||||
|
||||
app.use(express.json());
|
||||
@@ -18,7 +21,7 @@ app.use("/api/posts", require("./routers/api/posts"));
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
console.log("in production");
|
||||
app.use(express.static("client/build"));
|
||||
app.get("*", (req, res) => [
|
||||
app.get("*", (_, res) => [
|
||||
res.sendFile(path.resolve(__dirname, "client", "build", "index.html")),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user