MovieHut is a free and open source, Node.js REST API, a mini-project I did for fun really. It has three endpoints : /random
, /movie/:name
, and /movies
, all explained below.
Deployed on Heroku (Previously on EC2)
Deployed on MongoDB Atlas, the database includs top 1000 rated movies from IMDb.
The API is accessible here. See the docs for further examples of usage on other endpoints.
GET /api/random
{
"_id": "6062ff36dd0c731bbd383d16",
"name": "12 Angry Men",
"releaseYear": 1957,
"certificate": "U",
"runtime": "96 min",
"genre": "Crime, Drama",
"imdbRating": 9,
"overview": "A jury holdout attempts to prevent a miscarriage of justice by forcing his colleagues to reconsider the evidence.",
"metaScore": "96",
"director": "Sidney Lumet"
}
GET /api/movie/:name
{
"_id": "6062ff36dd0c731bbd383d1b",
"name": "Fight Club",
"releaseYear": 1999,
"certificate": "A",
"runtime": "139 min",
"genre": "Drama",
"imdbRating": 8.8,
"overview": "An insomniac office worker and a devil-may-care soapmaker form an underground fight club that evolves into something much, much more.",
"metaScore": "66",
"director": "David Fincher"
}
GET /api/movies
Parameter | Type | Description | Example |
---|---|---|---|
limit | Number | Minimum: 1 , Maximum: 100 , Default: 10 The number of movies to fetch at once per page |
See in browser |
page | Number | Minimum: 1 , Maximum: 100 , Default: 1 The page no. for the results |
See in browser |
select | String | Fetch only the selected/particular feilds for the movie. Must be comma seperated (see example) | See in browser |
The data array containes 5 (the limit we give) objects...
{
"status": true,
"pagination": {
"next": {
"page": 6,
"limit": 5
},
"prev": {
"page": 4,
"limit": 5
}
},
"data": [{}, {}, {}, {}, {}]
}
Make sure you are atleast using the following versions:
- Node: 14.5.5
- npm: 6.14.11
- MongoDB: 4.4.2
-
Create a MongoDB database locally or on Atlas
-
Seed the db using mongoimport (or some other way your prefer)
-
Create a file named
config.env
in theconfig
folder. Add the following variables with your parameters:
NODE_ENV=<your-enviroment>
PORT=<port>
MONGO_URI=<your-local-or-atlas-mongodb-uri>
- Do the good old:
npm i && nodemon server
All contributions, from code to docs' improvement are more than welcome. To do so you can:
-
Fork the repo
-
Clone the forked repo on your local machine
-
Create a new branch from master
-
Do your thing and commit your changes
-
Push the changes to your fork
-
Add a pull request on the project and wait until we review and merge them