A full-stack application that includes an ASP.NET Core Web API for managing monsters and an Angular client for interacting with the API. The application uses an in-memory database for data storage and is containerized using Docker.
- Download Docker.
- Run the container
docker-compose up -d
.
This will pull the container image from the GitHub Docker Registry.
-
ASP.NET Core Web API:
- Endpoints for creating, retrieving, and managing monsters.
- In-memory database for lightweight data storage.
- Swagger/OpenAPI integration for API documentation.
-
Angular Client:
- User interface for viewing and adding monsters.
- Integration with the Web API using
fetch
for HTTP requests. - Bootstrap-based responsive design.
-
Dockerized Deployment:
- Single Docker container for both the API and the Angular client.
- Configured to run in production with proper port bindings.
- .NET 6 or later
- Node.js (for the Angular client)
- Docker (optional, for containerized deployment)
git clone <repository-url>
cd MonsterService
-
Navigate to the Service directory:
cd Service
-
Run the API:
dotnet run
-
The API will be available at http://localhost:5127 (or the port specified in your configuration).
-
Navigate to the Client directory:
cd Client
-
Install dependencies:
npm install
-
Run the Angular development server:
ng serve
-
The client will be available at http://localhost:4200
-
Build the Docker image:
docker build -t monster-service .
-
Run the Docker container:
docker run -d -p 8080:80 --name monster-service monster-service
-
Access the application at http://localhost:8080
After making changes to the project, the Docker container can be built and published to the Github Container Registry using the following steps.
docker login --username <USERNAME> --password <YOUR_PERSONAL_ACCESS_TOKEN> ghcr.io
docker build -t ghcr.io/primaryobjects/docker-monster:latest .
docker push ghcr.io/primaryobjects/docker-monster:latest
The Docker image can be launched using the following command to read docker-compose.yml
.
docker-compose up -d
Alternatively, manually launch the container.
docker run --name docker-monster-container -d -p 8080:80 ghcr.io/primaryobjects/docker-monster:latest
Base URL: /api/monster
- GET
/api/monster
: Retrieve all monsters. - GET
/api/monster/new
: Generate a new monster. - POST
/api/monster
: Add a new monster.
- Backend: ASP.NET Core, Entity Framework Core (InMemory Database)
- Frontend: Angular, Bootstrap
- Containerization: Docker
- API Documentation: Swagger/OpenAPI
MonsterService/
├── Client/ # Angular client
├── Service/ # ASP.NET Core Web API
│ ├── Controllers/ # API controllers
│ ├── Database/ # DbContext and database setup
│ ├── Managers/ # Business logic
│ ├── Types/ # Entity models
├── Dockerfile # Docker configuration
- Add authentication and authorization.
- Implement persistent database storage (e.g., SQL Server or PostgreSQL).
- Add unit and integration tests for both the API and the client.
- Enhance the UI with additional features like monster filtering and sorting.
MIT
Kory Becker https://primaryobjects.com