Skip to content

codebyfredrik/project-mongo-api

 
 

Repository files navigation

Custom Netflix API (Part 2)

Summary

A custom API created with Express and MongoDB to provide information about movies and TV shows on Netflix.

Implementation details

In this project I have implemented relevant API routes in Express to handle Netflix show requests. In the first version of the Custom Netflix API a JSON dataset was used to simulate the database. In this version a MongoDB database is used to store information about movies and TV shows on Netflix.

Mongoose, an Object Data Modeling (ODM) library for MongoDB and Node JS, is used in this project to manage relationships between data, provide schema validation, and translate between objects in code and the representation of those objects in MongoDB.

To combat invalid data in incoming API requests I decided to implement the Joi library, a powerful schema description language and data validator for JavaScript. Together with the middleware library Celebrate, which is an Express wrapper for the Joi library, Express can intercept and validate incoming requests objects before they even reach the route handler. The benefit of using a middleware is that the pure logic for validation is centralized, thus keeping the error handling logic in the route handlers to a minimum.

Technologies used

  • JavaScript ES6+
  • Node.js
  • Express - A minimal and flexible Node JS web application framework
  • MongoDB - A general purpose, document-based, distributed database
  • Mongoose - MongoDB object modeling for Node JS
  • Joi - A powerful schema description language and data validator
  • Celebrate - A Joi validation middleware for Express JS

Where can you see it in action?

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 50.6%
  • HTML 36.0%
  • CSS 13.4%