{"id":30069379,"url":"https://github.com/dangos-dev/dotnet8.scalarwebapi","last_synced_at":"2026-02-23T00:40:18.310Z","repository":{"id":308313431,"uuid":"929865730","full_name":"dangos-dev/DotNet8.ScalarWebApi","owner":"dangos-dev","description":"A basic ASP.NET Core Web API template (.NET 8) demonstrating interactive API documentation with Scalar.","archived":false,"fork":false,"pushed_at":"2025-02-09T15:35:07.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-05T09:52:30.554Z","etag":null,"topics":["asp-net-core","dotnet","dotnet8","scalar","webapi"],"latest_commit_sha":null,"homepage":"https://dotnet8.scalarwebapi.dangos.dev/scalar/v1","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dangos-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-09T15:34:16.000Z","updated_at":"2025-03-11T21:59:36.000Z","dependencies_parsed_at":"2025-08-05T09:52:31.704Z","dependency_job_id":"2d9017c3-590b-484b-a858-40058c688626","html_url":"https://github.com/dangos-dev/DotNet8.ScalarWebApi","commit_stats":null,"previous_names":["dangos-dev/dotnet8.scalarwebapi"],"tags_count":null,"template":true,"template_full_name":null,"purl":"pkg:github/dangos-dev/DotNet8.ScalarWebApi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangos-dev%2FDotNet8.ScalarWebApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangos-dev%2FDotNet8.ScalarWebApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangos-dev%2FDotNet8.ScalarWebApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangos-dev%2FDotNet8.ScalarWebApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dangos-dev","download_url":"https://codeload.github.com/dangos-dev/DotNet8.ScalarWebApi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dangos-dev%2FDotNet8.ScalarWebApi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269410221,"owners_count":24412157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","dotnet","dotnet8","scalar","webapi"],"created_at":"2025-08-08T11:09:19.703Z","updated_at":"2026-02-23T00:40:13.267Z","avatar_url":"https://github.com/dangos-dev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# WebApi Example with Scalar API Documentation\n![.Net](https://img.shields.io/badge/.NET-5C2D91?style=for-the-badge\u0026logo=.net\u0026logoColor=white)\n![C#](https://img.shields.io/badge/c%23-%23239120.svg?style=for-the-badge\u0026logo=csharp\u0026logoColor=white)\n\nThis project demonstrates a simple Web API built with ASP.NET Core **targeting .NET 8**, showcasing interactive API\ndocumentation using [Scalar](https://github.com/domaindrivendev/Swashbuckle.AspNetCore).\n\n[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/template/_R3Eu2?referralCode=Al2B-n)\n\n## Live Demonstration\n\nThis template offers a live demonstration of the API's functionality through the integrated Scalar UI.  This interactive environment provides a hands-on experience for understanding and testing the API endpoints.\n\n**Access the Live API Demonstration:** [**View Interactive Demo**](https://dotnet8.scalarwebapi.dangos.dev/scalar/v1)\n\n## Getting Started\n\nFollow these steps to run the Web API example on your local machine.\n\n### Prerequisites\n\n- **[.NET SDK 8.0](https://dotnet.microsoft.com/download)** - Make sure you have the **.NET SDK 8.0** installed to build\n  and run ASP.NET Core applications. This project is built and tested using **.NET 8**.\n\n### Running the Application\n\n1. **Clone the repository:** If you haven't already, clone this GitHub repository to your local machine.\n\n``` bash\ngit clone https://github.com/dangos-dev/DotNet8.ScalarWebApi.git\ncd DotNet8.ScalarWebApi\n```\n\n2. **Run the application:** Execute the following dotnet CLI command to start the Web API:\n\n``` bash\n dotnet run\n```\n\n3. **Access API Documentation:** Once the application is running, you can access the API documentation through your web\n   browser:\n    - **Scalar UI:** Open your browser and navigate to the `/scalar` endpoint. For example:\n      `https://localhost:5001/scalar/v1` or `http://localhost:5000/scalar/v1`. The specific port will be shown in the console\n      output when you run the application.\n\n    - **OpenAPI JSON:** The raw OpenAPI document in JSON format is available at `/openapi/v1.json`. For example:\n      `https://localhost:5001/openapi/v1.json`\n\n## API Endpoints\n\nThe `HelloWorldController` in this example provides the following endpoints:\n\n- **GET /HelloWorld**\n\n    - **Description:** Returns a simple \"Hello World! 🍡\" greeting message.\n    - **Response Example (200 OK):**\n\n      ```\n      Hello World! 🍡\n      ```\n\n- **GET /HelloWorld/echo**\n\n    - **Description:** This endpoint echoes back the message provided in the `message` query parameter.\n    - **Query Parameters:**\n        - `message` (string, required): The message you want to be echoed.\n    - **Request Example:**\n\n        ```\n        /HelloWorld/echo?message=YourTestMessage\n        ```\n\n    - **Response Example (200 OK):**\n\n        ```\n        Echo: YourTestMessage\n        ```\n\n    - **Error Response (400 Bad Request):**\n        - **Condition:** If the `message` query parameter is missing or empty.\n        - **Response Body:**\n\n            ```\n            Please provide a message to echo.\n            ```\n\n## Key Files\n\nHere are the key code files for this template:\n\n- **`Program.cs`**: The main application startup file, configuring services and middleware, including Scalar for API\n  documentation.\n\n- **`Controllers/HelloWorldController.cs`**: Defines the `HelloWorldController` with the API endpoints.\n\n  ``` csharp\n      ApiController]  \n      [Route(\"[controller]\")]  \n      public class HelloWorldController(ILogger\u003cHelloWorldController\u003e logger) : ControllerBase {  \n    \n          [HttpGet] [Route(\"\")]// Matches GET requests to /HelloWorld  \n          public IActionResult GetHelloWorld() {  \n              logger.LogInformation(\"Hello World endpoint was hit.\");  \n    \n              return Ok(\"Hello World! 🍡\");  \n          }\n      }\n  ```\n\n## Scalar Configuration\n\nScalar API documentation is configured in `Program.cs` using the `app.MapScalarApiReference` extension method.\n\n```csharp\napp.MapScalarApiReference(\n    opt =\u003e {\n        opt.Title = \"WebApi with Scalar Example\";\n        opt.Theme = ScalarTheme.BluePlanet;\n        opt.DefaultHttpClient = new(ScalarTarget.Http, ScalarClient.Http11);\n    }\n);\n```\n\n- **`Title`**: Sets the title of the documentation displayed in the Scalar UI (e.g., \"WebApi Example\").\n- **`Theme`**: Applies the `BluePlanet` theme to customize the appearance of the Scalar UI.\n- **`DefaultHttpClient`**: Configures the default HTTP client settings for Scalar.\n\n## Dependencies\n\nThis project relies on the following NuGet packages:\n\n- [Scalar.AspNetCore](https://www.google.com/url?sa=E\u0026source=gmail\u0026q=https://www.nuget.org/packages/Scalar.AspNetCore):\n  For integrating Scalar API documentation into ASP.NET Core.\n- [Swashbuckle.AspNetCore.SwaggerGen](https://www.google.com/url?sa=E\u0026source=gmail\u0026q=https://www.nuget.org/packages/Swashbuckle.AspNetCore.SwaggerGen) \u0026 [Swashbuckle.AspNetCore.SwaggerUI](https://www.google.com/url?sa=E\u0026source=gmail\u0026q=https://www.nuget.org/packages/Swashbuckle.AspNetCore.SwaggerUI):\n  Used by Scalar for OpenAPI document generation and UI.\n\n## Author\n\nThis template is a basic example to help you get started with building ASP.NET Core Web APIs using .NET 8 and\ndocumenting them with Scalar. Feel free to use and modify it for your own projects.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdangos-dev%2Fdotnet8.scalarwebapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdangos-dev%2Fdotnet8.scalarwebapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdangos-dev%2Fdotnet8.scalarwebapi/lists"}