-
Notifications
You must be signed in to change notification settings - Fork 87
Appended the documentation to Readme.md #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6d6aa93
8a1cd59
fb71034
6d94f78
280a4a2
a552aed
94041ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| ### How to Run | ||
|
|
||
| - Clone the repository for this project by running the following command in a terminal: | ||
| ##### `git clone https://github.com/lugenx/ecohabit.git` | ||
| - Open the cloned folder in VS Code. Open the terminal and make sure its pointing to the root of the cloned project. | ||
|
|
||
|
|
||
| - Database creation | ||
| - Create a mongodb account through the [MongoDB Website](https://www.mongodb.com) | ||
| - Create a cluster (by default is Cluster0 which can be used) | ||
| - Once the cluster is up, you need to click on the 'Connect' tab and follow the drivers section to retrieve the mongodb connection url and save it for the next steps | ||
|
|
||
| <br> | ||
|
|
||
| - Running Backend Node JS Application: | ||
|
|
||
| - Change the directory to server folder using terminal command: `cd server` | ||
| - At the root of the server directory, create an .env file and copy the content from .env.example into the new .env file. | ||
| - update the 'MONGODB_URL' property in the .env file with the mongodb connection url saved during Database creation | ||
| - In the server directory, you can run: | ||
|
|
||
| ##### `npm install` | ||
|
|
||
| - It'll download all the packages/dependencies as defined in package.json file. Once the system completes this process, we can type below command: | ||
|
|
||
| ##### `npm start` | ||
|
|
||
| - Runs the app in the development mode. | ||
| - You can start making http calls to [http://localhost:3001](http://localhost:3001) | ||
|
|
||
| - Running Frontend React JS Application: | ||
|
|
||
| - Change the directory to client folder using terminal command: `cd client` | ||
| - In the client directory, you can run: | ||
|
|
||
| ##### `npm install` | ||
|
|
||
| - It'll download all the packages/dependencies as defined in package.json file. Once the system completes this process, we can type below command: | ||
|
|
||
| ##### `npm start` | ||
|
|
||
| - Runs the app in the development mode. | ||
| - Open [http://localhost:3000](http://localhost:3000) to view it in the browser | ||
|
|
||
| - The page will reload if you make edits. | ||
| - You will also see any lint errors in the console. | ||
|
|
||
| - Insert habit dummy data: | ||
|
|
||
| - Go back to the MongoDB website to your project you created. | ||
| - You will see a 'test' collection populated | ||
| - Inside 'test', you will find 'habit' as a subcollection, open it and you can insert the below dummy documents | ||
|
|
||
| ``` | ||
| { | ||
| category: "Recycle", | ||
| description: "Reduce the amount of waste by using reusable bags!", | ||
| question: "Which one of these did you use today?", | ||
| answerOptions: ["clothbag"], | ||
| __v:0 | ||
| } | ||
| ``` | ||
|
|
||
| ``` | ||
| { | ||
| category: "Commute", | ||
| description: "Carpool with coworker or friends", | ||
| question: "How did you commute to work today?", | ||
| answerOptions: ["Uber", "Lyft"], | ||
| __v:0 | ||
| } | ||
| ``` | ||
|
|
||
| ``` | ||
| { | ||
| category: "Recycle", | ||
| description: "Separate bin for recycle stuff", | ||
| question: "How much did you dump today for recycle", | ||
| answerOptions: ["3boxes", "4boxes"], | ||
| __v:0 | ||
| } | ||
| ``` | ||
| - Note: When you insert a document, append the above json fields to the already defined unique id in the document | ||
|
|
||
| - The link [MongoDB Insert Document](https://www.mongodb.com/docs/manual/tutorial/insert-documents/) | ||
| shows how to insert the document in the mongodb manually through the UI | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,10 +48,22 @@ If you prefer the command line way of downloading and installing things, then fe | |
| ##### `git clone https://github.com/lugenx/ecohabit.git` | ||
| - Open the cloned folder in VS Code. Open the terminal and make sure its pointing to the root of the cloned project. | ||
|
|
||
| - Running Backend Node JS Application: | ||
|
|
||
| - Create Database for development use: | ||
|
|
||
| - Create a mongodb account through the [MongoDB Website](https://www.mongodb.com) | ||
| - Create a cluster (by default is Cluster0 which can be used) | ||
| - Once the cluster is up, you need to click on the 'Connect' tab | ||
| - Follow the drivers section to retrieve the mongodb connection url and save it for the next steps | ||
| - Connection url - mongodb+srv://(username):(password)@cluster0.xqzlrqf.mongodb.net/(databasename)?retryWrites=true&w=majority | ||
| - Replace the username and password you used for the mongo db account and put a databasename (eg. ecohabit) | ||
|
|
||
|
|
||
| - Run the backend NodeJS application: | ||
|
|
||
| - Change the directory to server folder using terminal command: `cd server` | ||
| - At the root of the server directory, create an .env file and copy the content from .env.example into the new .env file. | ||
| - Update the 'MONGODB_URL' property in the .env file with the mongodb connection url saved | ||
| - In the server directory, you can run: | ||
|
|
||
| ##### `npm install` | ||
|
|
@@ -80,6 +92,48 @@ If you prefer the command line way of downloading and installing things, then fe | |
| - The page will reload if you make edits. | ||
| - You will also see any lint errors in the console. | ||
|
|
||
| - Insert habit dummy data: | ||
|
|
||
| - Go back to the MongoDB website to your project. | ||
| - The collection with the databasename you provided will be present (created when you started the server app) | ||
| - Inside the collection, you will find 'habits' as a subcollection | ||
| - Open it and you can insert the below dummy documents | ||
|
|
||
| ``` | ||
| { | ||
| "category": "Recycle", | ||
| "description": "Reduce the amount of waste by using reusable bags!", | ||
| "question": "Which one of these did you use today?", | ||
| "answerOptions": ["Reusable bag", "Plastic bag", "Both", "None"] | ||
| } | ||
| ``` | ||
|
|
||
| ``` | ||
| { | ||
| "category": "Commute", | ||
| "description": "Carpool with coworker or friends", | ||
| "question": "How did you commute to work today?", | ||
| "answerOptions": ["Drived", "Carpooled", "Bike", "Public Transport"] | ||
| } | ||
| ``` | ||
|
|
||
| ``` | ||
| { | ||
| "category": "Recycle", | ||
| "description": "Separate your recycble materials", | ||
| "question": "Did you separate your recycble materials today?", | ||
| "answerOptions": ["Yes", "No"] | ||
| } | ||
| ``` | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just paid attention to the content here, I know this is just test data, but I think it would be nice to have the data closer to something we would really use in real. For example, having Uber or Lyft as ridesharing is not something our habit tracker shoud care about. See the below data as example: |
||
| - Note: When you insert a document, append the above json fields to the already defined unique id in the document | ||
|
|
||
| - The link [MongoDB Insert Document](https://www.mongodb.com/docs/manual/tutorial/insert-documents/) | ||
| shows how to insert the document in the mongodb manually through the UI | ||
|
|
||
|
|
||
| - The page will reload if you make edits. | ||
| - You will also see any lint errors in the console. | ||
|
|
||
| ## Roadmap | ||
|
|
||
| - _List any features planned_ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
Documentation.mdfile.