A Web API built with ASP.NET Core for managing movie characters, movies, and franchises. The API allows you to track characters across different movies and movie franchises.
These instructions will help you get a copy of the project up and running on your local machine for development and testing purposes.
- Visual Studio 2022
- .NET 6.0 SDK
- SQL Server Express
- SQL Server Management Studio (SSMS) - Recommended for database management
-
Clone the Repository
git clone https://github.com/Nesegreven/MovieCharactersAPI.git
-
Check Database Connection String
- Open
appsettings.json
- Verify the connection string matches your SQL Server instance:
"ConnectionStrings": { "DefaultConnection": "Server=localhost\\SQLEXPRESS;Database=MovieCharactersDb;Trusted_Connection=True;TrustServerCertificate=True" }
- Open
-
Create Initial Database
- Open Package Manager Console in Visual Studio (Tools → NuGet Package Manager → Package Manager Console)
- Run the following commands:
Add-Migration InitialCreate Update-Database
-
Run the Application
- Start the application in Visual Studio (F5 or press the "Play" button)
- The database will be seeded with initial data on the first run
- Swagger UI will open automatically at
http://localhost:5000/swagger
On first run, the database will be seeded with:
- Two franchises:
- Marvel Cinematic Universe
- The Lord of the Rings
- Several characters:
- Tony Stark (Iron Man)
- Thor Odinson
- Frodo Baggins
- Gandalf
- Aragorn
- Legolas
- Samwise Gamgee
- Four movies:
- Iron Man
- The Lord of the Rings trilogy:
- The Fellowship of the Ring
- The Two Towers
- The Return of the King
Once running, you can access the Swagger documentation at:
This provides a complete API reference with examples and the ability to test endpoints directly.
- ASP.NET Core 6.0
- Entity Framework Core
- SQL Server
- AutoMapper
- Swagger/OpenAPI
Controllers/
- API endpointsModels/
- Database entitiesDTOs/
- Data Transfer ObjectsData/
- DbContext and database configurationServices/
- Business logicMiddleware/
- Custom middleware (error handling, etc.)
- HTTP is used instead of HTTPS for development simplicity
- The database is automatically created and seeded on first run
- Swagger UI is enabled in development mode
- Custom error handling is implemented
- Characters can appear in multiple movies (many-to-many)
- Movies can belong to one franchise (many-to-one)
- Franchises can have multiple movies (one-to-many)
- Simen Bergh
This project is licensed under the MIT License - see the LICENSE file for details