From e809999b6891474cd8f91e4400f8030403be718e Mon Sep 17 00:00:00 2001 From: MohamedSobhy404 Date: Tue, 7 Oct 2025 19:11:38 +0000 Subject: [PATCH] Upload files to "/" update readme.md --- README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aeb4a2f..3c9af2d 100644 --- a/README.md +++ b/README.md @@ -1 +1,91 @@ -# WebApplication1 \ No newline at end of file +# 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`). + +```bash +dotnet run +``` + +### Running Tests + +This project includes a test script. To execute the tests, run the following command from the root directory: + +```bash +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:** + +```json +{ + "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. + +```json +{ + "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 + +---