Node.js server to compute and store data, providing services to Trash Walk mobile app.
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:
- It documents the efforts made, for the ones volunteering their time (and everyone else!).
- Make the activitity more gratifying to the trash walkers themselves by "gamification" and social functions.
A few things you have to take in consideration before using Trash Walk - Server
After cloning the repo you'll have to :
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
Start the server:
cd trash-walk-backend
npm start
Use the Trash Walk.postman_collection.json to test all API endpoints.
Front-end: trash-walk-frontend
This project is licensed under the MIT License - see the LICENSE.md file for details