A REST API that scrapes data from Wikipedia's list of Indonesian films and provides movie information such as title, cast, category, and director.
- Node.js
- npm
- Clone the repository:
git clone https://github.com/chrystalio/movie-api.git
- Install dependencies:
npm install
- Start the server:
npm run dev
If you prefer running the application in a Docker container, follow these steps:
- Build the Docker image:
docker build -t chrystalio/movie-api:1.0 .
- Run the Docker container:
docker run -p 3000:3000 --name movie-api-container chrystalio/movie-api:1.0
- Access the API at
http://localhost:3000/
Once the server is running, you can access the API by sending a GET request to the /
endpoint:
http://localhost:3000/
By default, the API returns the first 10 movies. You can specify the number of movies to return and the page number using query parameters:
http://localhost:3000/?page=1&limit=2
{
"data": [
{
"title": "Habibie & Ainun",
"casts": "Reza Rahadian, Bunga Citra Lestari",
"category": "Drama",
"director": "Faozan Rizal"
},
{
"title": "Cinta Brontosaurus",
"casts": "Raditya Dika, Eriska Rein, Soleh Solihun",
"category": "Comedy drama",
"director": "Fajar Nugros"
},
],
"pagination": {
"page": "1",
"limit": 3,
"totalMovies": 174,
"totalPages": 18
}
}
Also you can filter the data by categories by sending a GET request to the /category
endpoint:
http://localhost:3000/?category=Comedy&limit=3
{
"data": [
{
"title": "Pintar Pintar Bodoh",
"casts": "Warkop",
"category": "Comedy",
"director": "Arizal",
"notes": ""
},
{
"title": "Dongkrak Antik",
"casts": "Warkop",
"category": "Comedy",
"director": "Arizal",
"notes": ""
},
{
"title": "Maju Kena Mundur Kena",
"casts": "Warkop",
"category": "Comedy",
"director": "Arizal",
"notes": ""
},
],
"pagination": {
"page": 1,
"limit": 3,
"totalMovies": 22,
"totalPages": 3
}
}
Contributions are welcome! If you'd like to contribute to this project, please fork the repository and create a pull request.
This project is made possible with the help of the following libraries: