JokeAPI is a simple .NET 8.0 based CRUD Web API designed for managing and sharing jokes. Deployed as a containerized service in an Azure Linux App Service, it supports operations like fetching random jokes, managing categories, and voting on jokes.
- Retrieve a random joke or a random joke by category
- Fetch all categories or all jokes within a category
- Look up a joke by its ID
- Add new categories or jokes
- Associate existing jokes with additional categories
- Vote on jokes (like/dislike)
- .NET 8.0 SDK
- Docker
- Azure CLI
- Terraform
- PostgreSQL
- Visual Studio 2022 or compatible IDE
-
Clone the repository:
git clone https://github.com/your-repository/JokeAPI.git
-
Navigate to the JokesAPI project directory:
cd src/JokesAPI -
Restore dependencies:
dotnet restore
-
Configure the database connection:
Update the connection string in
appsettings.jsonfor PostgreSQL. Ensure the database exists in PostgreSQL with the corresponding name. -
Apply database migrations:
dotnet ef database update
-
Build the Docker image:
docker build -t jokeapi . -
Run the application:
docker run -p 8080:8080 jokeapi
The API will be accessible on
http://localhost:8080.
-
Navigate to the terraform directory:
cd infra/terraform -
Initialize Terraform:
terraform init
-
Create an execution plan:
terraform plan
-
Apply the plan to deploy to Azure:
terraform apply
For detailed instructions on SSH access to your custom container, refer to the Azure documentation.
This project is licensed under the MIT License - see the LICENSE.txt file for details.