Giter Club home page Giter Club logo

project-mongo-api's Introduction

Mongo API Project

In this project I learned about MongoDB and Mongoose. I have used the API Golden globes nominations 2010 (to current year).

The problem

First I had to seed the MongoDB with the data from my API. In order to do that I had to model data in Mongoose. It was a bit tricky to get everything in place, and in order to get the data into the MongoDB compass, a crucial step is to write: RESET_DATABASE=true npm run dev in the terminal. By doing this we first clear the database and then save the data. Since the code is asynchronous, we have to use async/await, otherwise the same data will be added to the database everytime we save.

I then created endpoints to return a collection of results as well as single results using Mongoose queries.

View it live

https://project-mongo-api-ingela.herokuapp.com/

Shows and array of all nominations: https://project-mongo-api-ingela.herokuapp.com/nominations

Shows one object, the winner from a specified year and within a specified genre: https://project-mongo-api-ingela.herokuapp.com/nominations/2011/Best%20Motion%20Picture%20-%20Animated/winner

Shows all objects from a specified year (year of the award): https://project-mongo-api-ingela.herokuapp.com/nominations/year/2019

In this endpoint we can query for all kind of information in the objects, for example to see all the movies that have won we could add this to the base URL: ?win=true. https://project-mongo-api-ingela.herokuapp.com/nominations?win=true

or use two queries like this ?win=true&nominee=Claire Danes: https://project-mongo-api-ingela.herokuapp.com/nominations?win=true&nominee=Claire%20Danes

Shows a specified category: https://project-mongo-api-ingela.herokuapp.com/nominations/category/Best%20Motion%20Picture%20-%20Drama

project-mongo-api's People

Contributors

ingelal avatar emolsz avatar dependabot[bot] avatar idlefingers 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.