Giter Site home page Giter Site logo

gregsandell / spotify-track-artist Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 130 KB

Creates a database of Spotify tracks and artists. Creates a set of REST services for adding tracks and querying the database populated from the Spotify API.

Shell 0.52% JavaScript 99.48%

spotify-track-artist's Introduction

spotify-track-artist

Creates a database of Spotify tracks and artists. Creates a set of REST services for adding tracks and querying the database populated from the Spotify API.

INSTALL

  1. sqlite3 should be installed somewhere on your system. For Mac users: if it's not already present at /usr/bin/sqlite3, try installing with HomeBrew.
  2. Choose a location for your Sqlite3 DB file. You can bring one into existnece simply with sqlite3 myDB.db and quitting (type.quit).
  3. In the file config/config.json update the value for the storage key to the absolute path of your sqlite3 DB file.
  4. Create a .env file in the root of the project. The expected contents are in a later section.
  5. Build the project: npm i
  6. Create the database tables: npm run migrate

RUNNING

  1. Start the REST server: npm run server
  2. Test the queries with your favorite app (Postman, Curl, etc.)

Database Manipulation

To restore the DB to it's blank state: npm run migrate:undo

To seed the data with tracks and artists to explore with REST services: npm run seed

To remove the seed data (this will remove all track and artist data): npm run seed:undo

REST Endpoints

path method query params body params
/api/add-track POST ISRC (string)
idx* (int)
/api/search-artist GET q (string) artist substring search term
/api/search-isrc GET q (string) an exact ISRC
/api/search-song GET q (string) song substring search term

* Spotify returns a track with an array of several items, idx is the index (0 to n-1) to be used.

The .env File

Key Value
STORAGE Absolute path to a sqlite3 database file
SPOTIFY_AUTH Basic <base64 string>
The base64 string should adhere to the requirements from the Authorization Code Flow section of the Spotify Authorization Guide, namely: client_id:client_secret
SPOTIFY_BASE_AUTH_URL https://accounts.spotify.com/
SPOTIFY_BASE_URL https://api.spotify.com/
SPOTIFY_TOKEN_ENDPOINT api/token
SPOTIFY_SEARCH_ENDPOINT v1/search
PORT Defaults to 5000 or set to your choice

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.