Skip to content

Commit

Permalink
Updating readme and adding docker scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHHamdy committed Sep 27, 2023
1 parent a59a125 commit a3c9345
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,28 @@ This app uses [NPM](https://www.npmjs.com/) to manage its dependences and packag

3. Create an `.env` file in `server/config/` *and* in `client/`. Copy everything from the respective `.env.example` files in both directories into these new files. **Do not delete the example!**

4. *For now*, as we do not yet have a way to connect to local instances of Mongo, you will have to create a database on [MongoDB Atlas](https://cloud.mongodb.com/) for use while developing this app. Make sure you include the connection string in your newly-created `.env` file, in the `server` directory. The variable name is `DB_STRING`.
4. We have a local MongoDB instance set up through Docker.
[Docker Desktop](https://www.docker.com/products/docker-desktop/) will need to be installed to run the database.
You can manage it using the following commands:
```
To start the local MongoDB instance, run:
npm run db:up
To stop the local MongoDB instance, run:
npm run db:stop
```

With the local MongoDB instance in place, you can now connect directly without the need for MongoDB Atlas during development.

To connect to the local MongoDB instance, follow these steps:

1. Open MongoDB Compass.
2. In the MongoDB Compass connection dialog, locate the "Connection String" field.
3. In your .env file, located in the server directory, copy the DB_STRING into the "Connection String" field
3. Click "Connect" to establish a connection to your local MongoDB instance.


5. To run the app locally, navigate to the `client` directory and run:
```
Expand All @@ -68,6 +89,7 @@ This app uses [NPM](https://www.npmjs.com/) to manage its dependences and packag

Then navigate to the `server` directory and run:
```
npm run db:up
npm run serve
```

Expand Down
4 changes: 3 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "nodemon index.js"
"serve": "nodemon index.js",
"db:up": "docker compose up -d mongo",
"db:stop": "docker compose stop mongo"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit a3c9345

Please sign in to comment.