From adc421dd505498e39aaa1839862b62cabf1641e8 Mon Sep 17 00:00:00 2001 From: amazingshellyyy Date: Wed, 21 Dec 2022 22:05:00 -0800 Subject: [PATCH] fix: make sure server work --- README.md | 7 ++++++- client/.env.production | 2 ++ server/src/index.js | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 client/.env.production diff --git a/README.md b/README.md index 7f55387..25d4de2 100644 --- a/README.md +++ b/README.md @@ -94,11 +94,16 @@ $ npm run deploy:heroku ### After creating heroku +if using webpack: remember to update the file of [client/webpack.prod.js](https://github.com/amazingandyyy/mern/blob/master/client/webpack.prod.js) ```javascript 'API_URI': JSON.stringify('https://your-super-amazing-heroku-app.herokuapp.com') ``` - +if using parcel +remember to update the file of [client/.env.production](https://github.com/amazingandyyy/mern/blob/master/client/.env.production.js) +``` + REACT_APP_API_URI=https://your-super-amazing-heroku-app.herokuapp.com +``` # Dependencies(tech-stacks) Client-side | Server-side --- | --- diff --git a/client/.env.production b/client/.env.production new file mode 100644 index 0000000..9f88b45 --- /dev/null +++ b/client/.env.production @@ -0,0 +1,2 @@ +REACT_APP_API_URI=https://mern-amazingandyyy.herokuapp.com +NODE_ENV=production \ No newline at end of file diff --git a/server/src/index.js b/server/src/index.js index 56e3d73..ad85588 100644 --- a/server/src/index.js +++ b/server/src/index.js @@ -23,7 +23,7 @@ mongoose.Promise = global.Promise; // App Setup app.use(cors({ - origin: ['https://www.amazingandyyy.com', 'http://localhost:3000'] + origin: ['https://www.amazingandyyy.com', 'http://localhost:3000', 'http://localhost:1234'] })); app.use(morgan('dev')); app.use(express.json())