Skip to content

doinyco/Backend-next-gym

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Next Gym API

Welcome to the My Next Gym API! This Flask-based backend API provides functionality for managing gym-related information and user interactions. This README will guide you through setting up and using the API.

Table of Contents

  1. Getting Started
  2. Features
  3. Prerequisites
  4. Installation
  5. Configuration
  6. Usage
  7. API Endpoints
  8. Database Models
  9. Frontend Project
  10. DEMO

Getting Started

These instructions will help you set up and run the backend application on your local machine.

Features

My Next Gym API offers the following features:

  • User registration and authentication
  • Gym place creation, retrieval, updating, and deletion
  • Workout history tracking
  • User-specific gym place and workout history management

Prerequisites

Before you begin, ensure you have the following installed on your machine:

  • Python (version 3.7 or higher)
  • pip (Python package manager)

Installation

  1. Clone this repository to your local machine:
git clone <repository-url>
  1. Change to the project directory:
cd <project-directory>
  1. Activate the virtual environment:
  • On Windows:

    venv\Scripts\activate
  • On macOS and Linux:

    source venv/bin/activate
  1. Install the required packages:
pip install -r requirements.txt

Configuration

Before running the application, make sure to set up your environment variables. Create a .env file in the project directory and add the following variables:

  • SECRET_KEY: A secret key for Flask's session management.
  • SQLALCHEMY_DATABASE_URI: The URI for your PostgreSQL database.
  • SQLALCHEMY_TEST_DATABASE_URI: The URI for your test database (if applicable).

By default, the application will run on http://localhost:5000.

Usage

To get started with the API, follow the installation instructions above. Once the API is up and running, you can use tools like Postman or curl to interact with the routes and enjoy the features provided by this project.

API Endpoints

Here are the available API endpoints:

Users

  • Register a New User

  • POST /user

  • Register a new user account.

  • Log in with a Registered User

  • POST /user/<username>

  • Log in with a registered user account.

  • Get All Users

  • GET /user

  • Retrieve information for all users.

  • Delete a User

  • DELETE /user/<user_id>

  • Delete a user account.

Gym Places

  • Create a New Gym Place

  • POST /places

  • Create a new gym place associated with a user.

  • Get All Gym Places of a User

  • GET /user/<user_id>/places

  • Get all gym places associated with a user.

  • Delete Gym Place

  • DELETE /places

  • Delete a gym place by its place ID.

Workout History

  • Create a New Workout History Entry

  • POST /histories

  • Create a new workout history entry associated with a user.

  • Delete Workout History Entry

  • DELETE /histories

  • Delete a workout history entry by its history ID.

Database Models

The application uses SQLAlchemy to interact with the database. Here are the relevant database models:

  • User: Represents a user with username, password, first name, and last name fields.
  • Place: Represents a gym place with location details and user association.
  • History: Represents a workout history entry with date, time spent, mood, and comments fields.

Frontend Project

You can find the frontend project for My Next Gym on GitHub. The frontend repository contains the user interface and client-side code for interacting with this API.

Frontend Project on GitHub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors