Skip to content

The backend of Trash Walk, a collaboration and tracker tool for a cleaner world.

License

Notifications You must be signed in to change notification settings

junagao/trash-walk-backend

 
 

Repository files navigation

Trash Walk - Server

Node.js server to compute and store data, providing services to Trash Walk mobile app.

MIT Licence

Trash Walk is a mobile (iOS) app aimed at helping us make the world a cleaner place! The app is a tool for people cleaning (doing "trash walks"), and uses their phones GPS to save their walks to a shared database. This brings two main benefits:

  1. It documents the efforts made, for the ones volunteering their time (and everyone else!).
  2. Make the activitity more gratifying to the trash walkers themselves by "gamification" and social functions.

Table of contents

Screenshots

Getting started

A few things you have to take in consideration before using Trash Walk - Server

After cloning the repo you'll have to :

Install global and local dependancies:

Migrate and connect Postgres database

Install PostgreSQL and PostGIS on your machine:

brew install postgres
brew install postgis

Access PostgresSQL command line on the default database "postgres":

psql postgres

Your bash should now look like this:

psql (10.3)
Type "help" for help.

postgres=#

Now create a new database for the current user and connect it:

postgres=# CREATE DATABASE trashwalk;
postgres=# \c trashwalk;

The result will be:

You are now connected to database "trashwalk" as user <user-name>.
trashwalk=#

Now set a password for the current user:

trashwalk=# ALTER USER <user_name> WITH PASSWORD 'new_password';

Finally, create the extension for PostGIS:

trashwalk=# CREATE EXTENSION postgis;

Always remember the semicolon or the syntax will not work.

Now your database setup is finished and you are ready to connect it with the server.

In order to do this, create an .env file in the root server folder with this structure:

DB_USER=<user-name>
DB_PASS=<password>
DB_HOST=localhost
DB_PORT=5432
DB_NAME=<db-name>

You also can change the port or database name on postgres configuration database.

Finally, migrate the database on your local machine:

cd trash-walk-backend
node_modules/.bin/sequelize db:migrate

Usage

Start the server:

cd trash-walk-backend
npm start

Postman collection

Use the Trash Walk.postman_collection.json to test all API endpoints.

Tech Stack

Back-end:

Developers team

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

The backend of Trash Walk, a collaboration and tracker tool for a cleaner world.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%