Skip to content

EmelieNyberg/project-mongo-api-ek

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Mongo API

This is a RESTful API built using Express and Mongoose to provide access to a dataset of Nintendo Switch games. The dataset includes game details like id, name, category, release_year, and rating. The project demonstrates how to model data with Mongoose, seed a MongoDB database, and build endpoints to query and retrieve data.

The problem

The task was to create an API that fetches data from a MongoDB database using Mongoose. Key challenges included:

  1. Modeling the dataset with Mongoose to ensure the data was stored consistently.
  2. Seeding the database with a JSON file containing the dataset.
  3. Creating RESTful endpoints for filtering and retrieving data based on parameters like category, release_year, and rating.
  4. Writing clean and reusable code while adhering to RESTful principles.

To solve these challenges, I:

  • Used mongoose to define models and interact with the database.
  • Wrote a seeding function to populate the database.
  • Used query parameters to add filtering and sorting functionality to the API endpoints.
  • Tested the API with tools like Postman and debugged using console logs.

If I had more time, I would:

  • Implement pagination using .skip() and .limit().
  • Add more advanced querying using MongoDB's aggregate pipeline.
  • Enhance error handling and validation of query parameters.

View it live

https://project-mongo-api-ek.onrender.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%