Giter VIP home page Giter VIP logo

backend's Introduction

MOODIBEATS

  • Free music for everyone!
  • Music by mood!
  • Copyright free music for video creators!

Contributors

Logan Hufstetler Davina Taylor Joh Humphreys Md Kawsar Hussen Jonathan Bernal Sammy Lee Xander Jake de los Santos

MIT Typescript Netlify Status

Project Overview

You can find the project at MOODIBEATS.

Endpoints

User Table

Column Name Attribute
id integer - auto-increments
name string - 128chars, can't be NULL
email string - 128chars, must be unique
token text - import from google directly
patreon_support boolean - defaults to false

POST /api/register/oauth
  • Register a user: User must have a name, email, and a token from google.
  • Request example:
{
    name:    "David Albert"
    email:   "[email protected]"
    token:   "ya29GlwIB9MO2nsd8GcYummrxI2x7lxkWITjIst0QVXxkR6y90yo-bwAupQRbOYpcRRuPUrt5HrKzdweEeJ6YNY_ufg5HtbsFHD894mR1w"
}
  • Returns
{
  id:  13,
  token:   "ya29GlwIB9MO2nsd8GcYummrxI2x7lxkWITjIst0QVXxkR6y90yo-bwAupQRbO
            YpcRRuPUrt5HrKz_DGkF6puDJTedweEI6eJ6YNY_ufg5HtbsFHD894mR1w"
}

GET /api/users/{user_id}
  • Must Be Logged in with Token
  • Returns an object with a single user's info. Only accessible by that user.
{
    "id": 17,
    "name": "David Albert",
    "email": "[email protected]"
}

DELETE /api/users/{user_id}
  • Must Be logged in and have a valid token
  • Permanently delete the user info. Only permissible by that user.

PUT /api/users/{user_id}
  • Must Be logged in and have a valid token
  • User can update user's name and email only. Only accessible by that user.

POST api/user/playlists
  • Must Be Logged in with Token
  • Create a playlist
  • Request example:
{
	"name": "My Playlist1",
	"user_id" : 16
}
  • Returns:
{ 
    "id": 4,
    "name": "My Playlist1",
    "user_id": 16
}

GET /api/user/playlists/{user_id}/playlists
  • Must Be Logged in with Token
  • Get users list of playlist
  • Returns Example:
[
    {
        "id": 4,
        "name": "My PlayList1",
        "user_id": 16
    },
    {
        "id": 5,
        "name": "My Playlist2",
        "user_id": 16
    }
]

GET /api/user/playlists/{playlist_id}
  • User Must Be Logged in with Token
  • Returns the requested playlist
  • Returns:
{
   "id": 4,
   "name": "My Playlist1",
   "user_id": 16
}

DELETE /api/user/playlists/{playlist_id}
  • User Must Be Logged in with Token
  • Delete the requested playlist

Post api/user/playlists/{playlist_id}/song
  • User Must Be Logged in with Token
  • Add a song in a playlist
  • Request:
{
	"song_id": "fghr_jje34",
	"playlist_index" : 1
}
  • Returns :
{
    "id": 5,
    "playlist_id": 4,
    "song_id": "fghr_jje34",
    "playlist_index": 1
}

GET api/user/playlists/{playlist_id}/songs
  • User Must Be Logged in with Token
  • Returns the list of the songs of the requested playlist
  • Returns :
[
    {
        "id": 5,
        "song_id": "fghr_jje34",
        "playlist_index": 1
    },
    {
        "id": 6,
        "song_id": "kfjr95_fi",
        "playlist_index": 2
    },
    {
        "id": 7,
        "song_id": "fgfh65_hrt",
        "playlist_index": 3
    }
]

DELETE /api/user/playlists/{playlist_id}/song/{song_id}
  • User Must Be Logged in with Token
  • Remove the song from the requested playlist

PUT /api/user/playlists/{playlist_id}/song/{song_id}
  • User Must Be Logged in with Token
  • Update a Song's order in a playlist
  • Request Example:
   {
	    "playlist_index" : 8
   }
  • Returns:
   {
	    "playlist_index" : 8
   }

Environment File

The environment file is required to run this project. The environment file must be in the root directory of the project. For the environment variable to be used in the project, you must have an assignment like this. Where the value is the link to the API that is being used. In our code, this can be used with the variable process.env.DV_ENV.

  • SECRET
  • DV_ENV

Documentation

See Frontend Documentation for details on the fronend of our project.

backend's People

Contributors

adamhinckley avatar blisscatalyst avatar kawsarhussen16 avatar kevinbrack avatar lilvina avatar xanderjakeq avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.