Code Monkey home page Code Monkey logo

project-mongo-api's Introduction

Project Top Music API

This project is a RESTful API for a database of top music. The API allows users to search for songs, artists, and song properties like genre and danceability. It was built using Node.js, Express, and MongoDB.

The Problem

The main challenge of this project was designing an API that allows users to search for music by various parameters such as song ID, artist name, track name, genre, and danceability. The API provides several routes for these actions.

Technologies used:

  • Node.js
  • Express
  • CORS
  • Mongoose
  • MongoDB
  • Google Cloud

MongoDB Schema:

A song in the database is defined with the following properties:

  • id: The song's identifier, a number.
  • trackName: The song's name, a string.
  • artistName: The artist's name, a string.
  • genre: The song's genre, a string.
  • bpm, energy, danceability, loudness, liveness, valence, length, acousticness, speechiness, popularity: Various characteristics of the song, all numbers.

Endpoints:

  • /Index route listing all available endpoints
  • /songs - GET route to search for songs by genre and danceability
  • /songs/id/:id - GET route to search for a song by its MongoDB ID
  • /artists/:artistName - GET route to search for songs by an artist's name
  • /songs/:trackName - GET route to search for a song by its name

How to run the API locally:

  • Clone the repository
  • Install dependencies with npm install
  • Make sure MongoDB is installed and running
  • If you want to reset and populate the database, set an environment variable RESET_DB to true. The database will be populated with data from data/top-music.json
  • Run the server with npm start
  • Access the API at http://localhost:8080

API Deployed on Google Cloud:

https://project-mongo-api-45a55p775a-lz.a.run.app/

project-mongo-api's People

Contributors

camcron avatar emolsz 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.