React Redux Blog and API are two repos joined into one in this repository using docker. The db is mongo using a docker image.
- Create an
.env.local
file in thereact-redux-blog
directory. - Add the following line: REACT_APP_API_URL=http://localhost:4000
- In the
node-blog-api/server/config
create aconfig.json
file - Add the following:
{
"development": {
"MONGODB_URI": "mongodb://localhost:27017/react-redux-blog",
"JWT_SECRET": "3qd82380wdf",
"PORT": 4000
},
"dockerdev": {
"MONGODB_URI": "mongodb://mongodb:27017/react-redux-blog",
"JWT_SECRET": "3qd82380wdf",
"PORT": 4000
}
}
This project comes with a 'hot-reload' docker environment via:
- Mounting the files the CRA dev server is watching as volume
- Similarly mounting volume for server application with nodemon
- Create a volume by typing
docker volume create mongodbdata
in the terminal. - From root folder type
docker-compose up
ordocker-compose up --build
to force rebuild in the terminal. - If you would like to add post, ssh into the mongo container using the
docker exec -it <container id> /bin/bash
and modify your user in the users collection to have role asadmin
.