2025-10-07 19:11:38 +00:00
2025-10-07 00:18:35 +03:00
2025-10-05 22:25:53 +03:00
2025-10-05 22:25:53 +03:00
2025-10-05 22:25:53 +03:00
2025-10-05 22:25:53 +03:00
2025-10-05 22:25:53 +03:00
2025-10-07 19:11:38 +00:00
2025-10-05 22:25:53 +03:00
2025-10-07 07:42:59 +03:00

WondersAPI 🏛️

A RESTful API built with ASP.NET Core to manage a collection of historical wonders. It provides full CRUD (Create, Read, Update, Delete) functionality and an endpoint to fetch a random wonder from the database.


Features

  • List all wonders: Get a complete list of all wonders in the database.
  • Get a specific wonder: Retrieve a single wonder by its unique ID.
  • Get a random wonder: Fetch a random wonder.
  • Create, Update, and Delete: Full support for managing wonder entries.
  • Structured Logging: Captures detailed logs for requests, operations, and errors.

Usage

Running the API

Use the following command to launch the project. The API will be available at the URLs specified in the launch profile (e.g., https://localhost:7247).

dotnet run

Running Tests

This project includes a test script. To execute the tests, run the following command from the root directory:

dotnet test

API Endpoints

The base URL for all endpoints is /api/wonders.

Method Endpoint Description
GET / Retrieves a list of all wonders.
GET /{id} Retrieves a single wonder by its ID.
POST / Creates a new wonder.
PUT /{id} Updates an existing wonder.
DELETE /{id} Deletes a wonder by its ID.
GET /random Retrieves a random wonder from the list.

Example: Create a new wonder

POST /api/wonders

Request Body:

{
  "name": "Great Pyramid of Giza",
  "country": "Egypt",
  "era": "Ancient",
  "type": "Tomb",
  "description": "The oldest and largest of the three pyramids in the Giza pyramid complex.",
  "discoveryYear": -2560
}

Success Response (201 Created):

The API will return the newly created wonder object, including its server-generated ID.

{
  "id": 1,
  "name": "Great Pyramid of Giza",
  "country": "Egypt",
  "era": "Ancient",
  "type": "Tomb",
  "description": "The oldest and largest of the three pyramids in the Giza pyramid complex.",
  "discoveryYear": -2560
}

Technologies Used 🔧

  • Framework: ASP.NET Core 8
  • Architecture: RESTful API with standard controller patterns

الوصف
لا يوجد وصف
اقرأني 342 KiB
اللغات
C# 63.6%
Shell 36.4%