Skip to content

Back-end for Project Clean-Up, a School of Code final project by The Environment Variables.

Notifications You must be signed in to change notification settings

SchoolOfCode/environment_variables_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Clean-Up

Project Clean-up Backend

Group 23

This is the final project app we created while attending the School Of Code

(April - August 2022).

Project Clean-Up is an app that allows people to create or join

litter cleanup events.

We chose this app as we are all aware of the pollution crisis the

world is facing and we wanted to be pro-active about addressing this.

This documentation is for the backend of the Project Clean-up app.

If you're interested in the frontend specifically,

go to [https://github.com/SchoolOfCode/environment_variables_frontend]**

Deployed on vercel: https://projectcleanup.netlify.app/

Authors (aka, Team Environment Variables)

Click our names below to view out GitHub Profiles:

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)


DATABASE URI = <*Replace this text with URI*>

Run Locally

Navigate to where you would like to save the project

cd  <chosen directory>

Clone the project

git clone https://github.com/SchoolOfCode/environment_variables_backend

Navigate into the project directory

cd environment_variables_backend

Install dependencies

npm install (or npm i)

How the server works

Make sure you're inside the project directory (follow 'Run Locally' section)

To start the server:

npm run dev
  • The server should be running at http://localhost:5000

  • The server will update automatically to any changes, you don't need to close it everytime you wish to make a change

To close the server, press the following keys; (make sure you're inside the terminal)

ctrl C

Tech Stack

Engine: enter image description here

Deployed on: enter image description here

Dev Dependencies: enter image description here enter image description here

Dependencies: enter image description here

Data storage:

Running Tests

To run tests, run the following command

npm run test (or npm t)



  
## ***Usage/Examples***

  

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

  

You can set up some custom scripts to run specific files inside this project;

  

Scripts can be found inside of the package.json file

  

**Examples of scripts:**

  

Create a table:

```javascript

"db:createStartTable": "node -r dotenv/config ./db/scripts/startClean/createStartTable.js"

Populate the table:

"db:populateStartTable": "node -r dotenv/config ./db/scripts/startClean/populateStartTable.js"

Example of how to run these scripts:

Creates a table in Heroku

npm run db:createStartTable

Populates a table in Heroku

npm run db:populateStartTable

You can also populate tables remotely on your front end through post requests:

Example of using a post request:

const  handleSubmit  =  async  function (values) {

const  response  =  await  fetch(`${url}/logclean`, {

method: "POST",

headers: { "Content-Type": "application/json" },

body: JSON.stringify({

cleanname: values.cleanname,

bags: values.bags,

volunteers: values.volunteers,

}),

});

const  data  =  await  response.json();

console.log(data);

};

About

Back-end for Project Clean-Up, a School of Code final project by The Environment Variables.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published