Skip to content

Commit 911d51f

Browse files
Merge pull request #13 from SchoolOfCode/finalising-docs
Finalising docs
2 parents 6a5938b + c50cd97 commit 911d51f

File tree

1 file changed

+77
-161
lines changed

1 file changed

+77
-161
lines changed

README.md

Lines changed: 77 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,217 +1,141 @@
11

2-
# ***Project Clean-up***
3-
This is the final project app we created while attending the School Of Code
4-
(April - August 2022).
2+
![Project Clean-Up](https://user-images.githubusercontent.com/98705391/184337846-b06b80b3-98d3-40b4-912b-dc429ad54f72.png)
3+
# Welcome To Project Clean-up
4+
This is the repository for the back-end of Project Clean-up, an app created as a final project in the [School of Code's](https://www.schoolofcode.co.uk/) Bootcamp 12 (25 April - 16 August 2022). If you'd like to see the front-end, please check out the [git repository](https://github.com/SchoolOfCode/environment_variables_frontend).
55

6-
Project Clean-Up is an app that allows people to create or join
7-
litter cleanup events.
6+
![Earth, map, and map marker emojis](https://user-images.githubusercontent.com/98705391/184339535-2eb89ee6-2c6b-4376-baf3-2f5c4720e582.png)
87

9-
We chose this app as we are all aware of the pollution crisis the
10-
world is facing and we wanted to be pro-active about addressing this.
8+
### 🤔 **The Problem**
9+
Pollution and litter is a growing environmental crisis. Animals can choke on or ingest litter, suffocate in plastic bags, get entangled in elastics and plastics, or suffer injuries from discarded glass, metals and hooks. It can also present a danger to plant life, with flammable materials presenting a fire hazard, leak contaminants which can damage plants and inhibit their growth, or reduce light availability and moisture.
1110

12-
**This documentation is for the backend of the Project Clean-up app.
13-
If you're interested in the frontend specifically,
14-
go to [https://github.com/SchoolOfCode/environment_variables_frontend]**
11+
### 🧠 **Our Solution**
12+
Our aim is to help protect the wildlife and beauty of our green spaces by reducing litter and so the hazards it presents. Project Clean-Up is a full-stack app which enables people to join and create litter clean-up events in their communities—or further afield, if that's what takes their fancy!
1513

16-
<br/>
14+
### 🛠️ **How It Works**
15+
All of the clean-up events are stored in a database. The front-end makes requests to the database to display clean-up statistics, and populate the front page map with all events. Users can choose to join an event without registering, or register using Auth0 to start their own event⁠—which is then posted to the database and so visible on the front page map. After an event, the host can log their clean and submit the number of volunteers in attendance, and the amount of litter collected, which is then reflected in the statistics displayed on the page. A weather widget is included, along with advice for various weather conditions, so that users can ensure they are adequately prepared for the Great British weather on the day of their clean-up!
1716

18-
---
1917

20-
<br />
18+
## Authors (aka, the Environment Variables)
19+
**Click our names to view our GitHub Profiles**
2120

22-
## ***Authors (aka, Team Environment Variables)***
2321
- [Emma Gill](https://github.com/SurfingElectron)
24-
- [Amira Gucher-Blackman](https://github.com/amiragucher)
25-
- [Blake Lawrence](https://github.com/BlakeLawrence)
26-
- [Edgaras Markunas](https://github.com/EdMark11)
27-
- [Simran Rai](https://github.com/srai98i)
28-
- [Jena Zubaydi](https://github.com/jena-84)
29-
30-
<br/>
31-
32-
---
33-
34-
<br />
35-
36-
## ***Environment Variables***
37-
38-
To run this backend repository, please create a .env file in the root of the folder and inside there add your credentials in the following format; (these credentials can be found in your Heroku credential settings)
39-
40-
```
41-
DATABASE URI = <*Replace this text with URI*>
42-
```
43-
44-
<br/>
45-
46-
---
47-
48-
<br />
49-
50-
## ***Run Locally***
5122

52-
Navigate to where you would like to save the project
53-
54-
```bash
55-
cd <chosen directory>
56-
```
57-
58-
Clone the project
23+
- [Amira Gucher-Blackman](https://github.com/amiragucher)
5924

60-
```bash
61-
git clone https://github.com/SchoolOfCode/environment_variables_backend
62-
```
25+
- [Blake Lawrence](https://github.com/BlakeLawrence)
6326

64-
Navigate into the project directory
27+
- [Edgaras Markunas](https://github.com/EdMark11)
6528

66-
```bash
67-
cd environment_variables_backend
68-
```
29+
- [Simran Rai](https://github.com/srai98i)
6930

70-
Install dependencies
31+
- [Jena Zubaydi](https://github.com/jena-84)
7132

72-
```bash
73-
npm install (or npm i)
74-
```
7533

76-
<br/>
34+
## App Features
35+
The app offers a number of features to achieve its goal of helping users join and create litter clean-up events:
36+
- 🗺️ **Interactive maps**, so users can locate existing clean-ups, or select a location to start their own;
7737

78-
---
38+
-**A weather widget**, to allow users to check the weather for an upcoming event and prepare accordingly;
7939

80-
<br />
40+
- 📱 **Responsive design**, so the app can be used just as easily on mobile devices as it is on computers;
8141

82-
## ***How the server works***
42+
- 💽 **A custom database**, which stores all clean-up events, and responds to HTTP requests via our back-end;
8343

84-
Make sure you're inside the project directory (follow 'Run Locally' section)
44+
- 🔒 **User authentication**, to minimise spam, irrelevant or malicious postings, and to facilitate future features.
8545

86-
To start the server:
46+
## Installation 💻
47+
**Clone the front-end and back-end repositories to your computer:**
8748

8849
```bash
89-
npm run dev
90-
```
50+
https://github.com/SchoolOfCode/environment_variables_frontend
51+
https://github.com/SchoolOfCode/environment_variables_backend
9152

92-
- The server should be running at http://localhost:5000
93-
- The server will update automatically to any changes, you don't need to close it everytime you wish to make a change
94-
95-
To close the server, press the following keys; (make sure you're inside the terminal)
96-
97-
```bash
98-
ctrl C
9953
```
10054

101-
<br/>
102-
103-
---
104-
105-
<br />
106-
107-
## ***Tech Stack***
108-
109-
**Engine:** Node.js
110-
111-
**Dev Dependencies:** Nodemon, Babel, Jest, Supertest, Dotenv,
112-
113-
**Dependencies:** Express, PostgreSQL, Cors, Morgan
114-
115-
**Data storage:** Heroku
116-
117-
<br/>
118-
119-
---
120-
121-
<br />
122-
123-
## ***Running Tests***
124-
125-
To run tests, run the following command
126-
55+
**Install the dependancies for both with the following command:**
12756
```bash
128-
npm run test (or npm t)
57+
npm install
12958
```
13059

131-
<br/>
60+
To run this project, you will need to add the following environment variables to your back-end .env file:
13261

133-
---
62+
`DATABASE_URL = <place your database URL here>`
13463

135-
<br />
13664

137-
## ***Usage/Examples***
65+
## Tech Stack
66+
### Back-end & database
67+
![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white)
68+
![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB)
69+
![Nodemon](https://img.shields.io/badge/-nodemon-blue?style=for-the-badge&logo=nodemon)
70+
![Postgres](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white)
71+
![Heroku](https://img.shields.io/badge/heroku-%23430098.svg?style=for-the-badge&logo=heroku&logoColor=white)
13872

139-
Here are some basic examples of how to use this API:
14073

141-
You can set up some custom scripts to run specific files inside this project;
74+
### Testing
75+
![Postman](https://img.shields.io/badge/Postman-FF6C37?style=for-the-badge&logo=postman&logoColor=white)
76+
![Jest mini-banner](https://camo.githubusercontent.com/5ec7b7ed343219da6b2213349bacdc389803950b5298464b35e76f7ab6ccf27d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a6573742d4332313332353f7374796c653d666f722d7468652d6261646765266c6f676f3d6a657374266c6f676f436f6c6f723d7768697465)
77+
![Supertest mini-banner](https://img.shields.io/badge/-supertest-blue?style=for-the-badge&logo=jest)
14278

143-
Scripts can be found inside of the package.json file
14479

145-
**Examples of scripts:**
80+
## Usage/Examples
81+
Scripts to create, populate and drop tables in the database are inside the package.json file.
14682

147-
Create a table:
83+
### Script Examples
84+
Create a table to log new cleans:
14885
```javascript
14986
"db:createStartTable": "node -r dotenv/config ./db/scripts/startClean/createStartTable.js"
15087
```
15188

152-
Populate the table:
89+
Populate the above table with seed data:
15390
```javascript
15491
"db:populateStartTable": "node -r dotenv/config ./db/scripts/startClean/populateStartTable.js"
15592
```
15693

157-
**Example of how to run these scripts:**
158-
Creates a table in Heroku
94+
### Executing Script Examples
95+
Create a table to log new cleans:
15996
```bash
16097
npm run db:createStartTable
16198
```
16299

163-
Populates a table in Heroku
100+
Populate the above table with seed data:
164101
```bash
165102
npm run db:populateStartTable
166103
```
167104

168-
**You can also populate tables remotely on your front end through post requests:**
105+
### Testing
106+
To run the existing Jest tests, execute the following command:
169107

170-
Example of using a post request:
171-
172-
```javascript
173-
const handleSubmit = async function (values) {
174-
const response = await fetch(`${url}/logclean`, {
175-
method: "POST",
176-
headers: { "Content-Type": "application/json" },
177-
body: JSON.stringify({
178-
cleanname: values.cleanname,
179-
bags: values.bags,
180-
volunteers: values.volunteers,
181-
}),
182-
});
183-
const data = await response.json();
184-
console.log(data);
185-
};
108+
```bash
109+
npm run test (or npm t)
186110
```
187111

188-
<br/>
112+
## Challenges and how we overcame them
113+
There were numerous challenges on this project, often rooted in the circumstance of a team of junior developers grappling with new technologies. In general, we used our skills at working together, navigating documentation, parsing error messages, and researching solutions to find the solutions we needed.
189114

190-
---
115+
**Testing with Jest & Supertest**: We encountered some initial teething difficulties with implementing unit tests on the back-end. After some research and discussion with a School of Code coach, we were able to resolve those problems to write effective tests to ensure our API and database responded in the way we expected.
191116

192-
<br />
193117

194-
## ***API reference list***
118+
## What we took from this experience
119+
Our goal for this project was to work together well as a team, learn as much as we could, and at the end of it, present a functional and attractive app. We facilitated this by deciding on a team manifesto at the very start, which included important topics like how we wanted to approach discussions, make decisions, and resolve conflicts. We held true to our manifesto throughout the process, and as a result, any differences of opinion were smoothly resolved and the final decision embraced by all.
195120

196-
**For GET requests:**
121+
Working in an Agile way was an invaluable experience. We approached the project in an iterative way, and with each sprint updated or added features so we always had a functioning app. The ability to quickly pivot also helped us when we had to make changes due to our user’s feedback, adding clarity and functionality to our app to make it more usable.
197122

198-
Get all start clean data:
123+
We had a number of stretch goals, and with more time we would have added user profiles, notifications of upcoming and new events, and would have liked to spend some time refactoring duplicate code.
124+
125+
All in all, we had a fun and fantastic time together, worked hard, and are all very proud of our final product!
126+
127+
128+
## Appendix I: API Reference
129+
Get all existing cleans:
199130
```
200131
http://localhost:5000/startclean
201132
```
202133

203-
Get all log clean data:
134+
Get all the data from logged cleans:
204135
```
205136
http://localhost:5000/logclean
206137
```
207138

208-
Get all join clean data:
209-
```
210-
http://localhost:5000/joinclean
211-
```
212-
213-
**Using different routes:**
214-
215139
Sum of volunteers:
216140
```
217141
http://localhost:5000/logclean/volunteers
@@ -222,31 +146,23 @@ Sum of bags collected:
222146
http://localhost:5000/logclean/bagscollected
223147
```
224148

225-
**And the same is available for start clean data:**
226-
227149
Total cleans:
228150
```
229151
http://localhost:5000/startclean/totalcleans
230152
```
231153

232-
<br/>
233-
234-
---
235-
236-
<br />
237-
238-
## ***Appendix***
239-
240-
**Here are some links to documentation that could be helpful with using this server:**
241154

242-
- Node.js - https://nodejs.org/en/docs/
155+
## Appendix II: Third Party Documentation
156+
The following is a list of documentation which may be useful:
243157

244-
- PostgreSQL - https://www.postgresql.org/docs/
158+
- Node.js: https://nodejs.org/en/docs/
245159

246-
- Heroku - https://devcenter.heroku.com/categories/nodejs-support
160+
- Express: https://expressjs.com/en/starter/installing.html
247161

248-
- Jest - https://jestjs.io/docs/getting-started
162+
- PostgreSQL: https://www.postgresql.org/docs/
249163

250-
- Express - https://expressjs.com/en/starter/installing.html
164+
- Heroku: https://devcenter.heroku.com/categories/nodejs-support
251165

166+
- Jest: https://jestjs.io/docs/getting-started
252167

168+
- Supertest: https://www.jsdocs.io/package/supertest

0 commit comments

Comments
 (0)