Sign inSign up

user620/music-player-backend

By user620

•Updated almost 2 years ago

This repository contains the backend for the Music Player application built with FastAPI.

Image
API management
0

129

user620/music-player-backend repository overview

⁠FastAPI Music Player Backend

⁠Overview

This repository contains the backend for the Music Player application built with FastAPI. The backend handles audio file uploads, retrieves audio records, and integrates with Cloudinary for file storage. It also uses asynchronous operations with PostgreSQL and includes CORS middleware for security.

⁠Endpoints

⁠Upload Audio
  • Endpoint: /upload
  • Method: POST
  • Description: Uploads an audio file along with track name and author name.
  • Form Data:
    • track_name: Name of the track (string, required)
    • author_name: Name of the author (string, required)
    • file: Audio file (MP3, required)
  • Response:
    • id: ID of the audio record
    • url: URL of the uploaded audio file on Cloudinary
    • track_name: Name of the track
    • author_name: Name of the author
⁠Get Audio Tracks
  • Endpoint: /tracks
  • Method: GET
  • Description: Retrieves all audio records from the database.
  • Response:
    • A list of audio records with id, url, track_name, and author_name.

⁠Technologies Used

  • FastAPI: Modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
  • Asyncpg: PostgreSQL driver for asynchronous operations.
  • SQLAlchemy: SQL toolkit and Object-Relational Mapping (ORM) library for Python.
  • Cloudinary: Media management platform for storing and serving audio files.
  • CORS Middleware: Configured to allow specific origins for cross-origin requests.

⁠Frontend Integration

This backend service is integrated with the front-end project, which is deployed at Music Player UI⁠ and its repository is available here⁠.

⁠Setup and Installation

To set up and run the container, use the following commands:

  1. Build the Docker image:
    docker build -t music-player-backend .
    

docker run -d -p 8000:8000 music-player-backend

Tag summary

Content type

Image

Digest

sha256:0ff5108ec…

Size

72.4 MB

Last updated

almost 2 years ago

docker pull user620/music-player-backend:v3.0.0