mirror of
https://github.com/rjNemo/MERN_sample_app
synced 2026-06-12 03:26:40 +00:00
try to deploy
This commit is contained in:
parent
8ca0bc3549
commit
6d70937096
1 changed files with 4 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ import mongoose from "mongoose";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import helmet from "helmet";
|
import helmet from "helmet";
|
||||||
import { MONGO_URI } from "./config/keys.js";
|
// import { MONGO_URI } from "./config/keys.js";
|
||||||
import items from "./routes/api/items.js";
|
import items from "./routes/api/items.js";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
@ -11,7 +11,7 @@ const app = express();
|
||||||
// http port
|
// http port
|
||||||
const PORT = process.env.PORT || 5000;
|
const PORT = process.env.PORT || 5000;
|
||||||
// database connection key
|
// database connection key
|
||||||
const db = process.env.MONGO_URI || MONGO_URI;
|
const db = process.env.MONGO_URI; // || MONGO_URI;
|
||||||
|
|
||||||
// connection to database
|
// connection to database
|
||||||
mongoose
|
mongoose
|
||||||
|
|
@ -26,8 +26,8 @@ app.use(express.json());
|
||||||
// Register routes
|
// Register routes
|
||||||
app.use("/api/items/", items);
|
app.use("/api/items/", items);
|
||||||
|
|
||||||
// Serve static assets in Production
|
// Serve static assets in production
|
||||||
if (process.env.NODE_ENV === "PRODUCTION") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
app.use(express.static("client/build"));
|
app.use(express.static("client/build"));
|
||||||
app.get("*", (req, res) => {
|
app.get("*", (req, res) => {
|
||||||
res.sendFile(path.resolve(__dirname, "client", "build", "index.html"));
|
res.sendFile(path.resolve(__dirname, "client", "build", "index.html"));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue