This project is a RESTful API built with Node.js and Express.js. It processes movie data and calculates award intervals for producers, such as the maximum and minimum intervals between consecutive awards. The application uses SQLite for data storage, which is embedded as part of the Node.js project.
- Node.js (version 20)
- Docker (if you choose to run the application using Docker)
-
Clone the repository:
git clone https://github.com/your-repo/golden-raspberry-awards.git cd golden-raspberry-awards
-
Install the dependencies:
Inside the project directory, run the following command:
npm install
-
Set up environment variables:
Create a
.env
file in the root directory and add the following:PORT=3000 CSV_FILE_PATH=./data/movielist.csv ADDRESS="localhost" DATABASE_URL=:memory:
-
Run the application:
To start the server, run:
node app.js
-
Access the API:
Once the server is running, the API will be available at:
http://localhost:3000
-
API Documentation:
API documentation is available at:
http://localhost:3000/docs
-
Clone the repository:
git clone https://github.com/your-repo/golden-raspberry-awards.git cd golden-raspberry-awards
-
Build the Docker container:
Inside the project directory, run the following command to build the container:
docker-compose build
-
Start the application:
After the build is complete, start the application with:
docker-compose up
-
Access the API:
Once the container is up, the API will be available at:
http://localhost:3000
-
API Documentation:
API documentation is available at:
http://localhost:3000/docs
Unit tests:
npm test
- GET
/api/producers/awards
: Calculates and returns producers with the minimum and maximum award intervals.
Example response:
{
"min": [
{
"producer": "Producer 1",
"interval": 1,
"previousWin": 2008,
"followingWin": 2009
}
],
"max": [
{
"producer": "Producer 2",
"interval": 10,
"previousWin": 1995,
"followingWin": 2005
}
]
}
/src
/config # Database and environment configuration
/controllers # API controllers
/middleware # Global middleware for error handling, etc.
/models # Database models (SQLite)
/routes # API routes
/services # Business logic and calculations
/data # CSV file containing movie data
Dockerfile # Docker configuration
docker-compose.yml # Docker Compose configuration
.env # Environment variables
This project is licensed under the MIT License - see the LICENSE file for details.