You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
5
5
6
-
Project Clean-Up is an app that allows people to create or join
7
-
litter cleanup events.
6
+

8
7
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.
11
10
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!
15
13
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!
17
16
18
-
---
19
17
20
-
<br />
18
+
## Authors (aka, the Environment Variables)
19
+
**Click our names to view our GitHub Profiles**
21
20
22
-
## ***Authors (aka, Team Environment Variables)***
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***
51
22
52
-
Navigate to where you would like to save the project
**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:
169
107
170
-
Example of using a post request:
171
-
172
-
```javascript
173
-
consthandleSubmit=asyncfunction (values) {
174
-
constresponse=awaitfetch(`${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
-
constdata=awaitresponse.json();
184
-
console.log(data);
185
-
};
108
+
```bash
109
+
npm run test (or npm t)
186
110
```
187
111
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.
189
114
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.
191
116
192
-
<br />
193
117
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.
195
120
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.
197
122
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:
199
130
```
200
131
http://localhost:5000/startclean
201
132
```
202
133
203
-
Get all log clean data:
134
+
Get all the data from logged cleans:
204
135
```
205
136
http://localhost:5000/logclean
206
137
```
207
138
208
-
Get all join clean data:
209
-
```
210
-
http://localhost:5000/joinclean
211
-
```
212
-
213
-
**Using different routes:**
214
-
215
139
Sum of volunteers:
216
140
```
217
141
http://localhost:5000/logclean/volunteers
@@ -222,31 +146,23 @@ Sum of bags collected:
222
146
http://localhost:5000/logclean/bagscollected
223
147
```
224
148
225
-
**And the same is available for start clean data:**
226
-
227
149
Total cleans:
228
150
```
229
151
http://localhost:5000/startclean/totalcleans
230
152
```
231
153
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:**
241
154
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:
0 commit comments