SchoolOfCode / final-project_back-end-bootglampers

final-project_back-end-bootglampers created by GitHub Classroom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Medi-Mate - BACK-END

There are many people who would like to meditate, but struggle to build that habit.

Our app uses gamification to encourage daily visits to build that meditation habit. Along with your chosen Medi-Mate, you will learn to breath and meditate alongside your new friend and keep them happy and healthy.

Looking for the Front-end?

Live website

Installation

  git clone https://github.com/SchoolOfCode/final-project_back-end-bootglampers.git

  cd final-project_back-end-bootglampers

  npm i

Run the back-end

To run the front end:

  npm run dev

This will open the project on localhost:19006 unless you specify a different PORT variable in your .env file.

This script will use nodemon, so it will watch your files for changes, and it will re-start the server whenever a change occurs.

Now your project will be running but you still won't be able to connect to the Heroku database, because you are missing the necessary database credentials.

If you want to connect to a database, first create an Heroku database here.

Once you have created a database, grab the database URL, create .env file in your root directory and assign the database URL value to a variable called DATABASE_URL like so:

DATABASE_URL = secretdatabaseurl you also might want to assign a different port in the .env file, like so:

PORT = 5000

If you have done all of the following things, stop your server and start it again (nodemon doesn't detect changes to your .env file) and it should all be working fine.

Tech Stack

The reasons behind the techstack we choose

We were familiar with the tech stack for our back-end, having used it previously in the course. We were already using new technologies on the front-end, so decided to play it safe on the back-end. Additionally, a relational database served our planned data structure.

The app we built is a meditation app. We needed an api that would allow us to store and retrieve information about users, the selections they make on the app and tracking their usage.

A PostgreSQL database made sense for our app, there wouldn't be a large number of routes and the information we were looking to store for each user was quite minimal.

We used Heroku to store our database and also used Heroku to host the back-end.

There are four linked tables, main user table capturing the id generated by firebase registration, the Medi-Mate table, that retains the name and age of your medi-mate character, the meditation log table that saves the details of frequency and length of meditation and finally, the mood log, that stores the daily moods that the user choses. All tables are linked with a foreign key.

The API performs various CRUD actions for six routes

  • /api/registration/ -> initial post request to register a new user
  • /api/register-pet/ -> post request when users names their Medi-Mate
  • /api/pet-id/ -> get request to check user has a medi-mate registered and can divert the user to the main hub page, bypassing the medi-mate name process
  • /api/meditation/ -> post request to log meditation length
  • /api/stats/ -> get requests for number of visits, total meditation time, streak days used site, average mood logged,
  • /api/mood-log/ -> post when users logs how they are feeling

Authors

About

final-project_back-end-bootglampers created by GitHub Classroom


Languages

Language:JavaScript 99.9%Language:Procfile 0.1%