{"id":21954796,"url":"https://github.com/mgernand/aspnetcore.endpoints","last_synced_at":"2025-04-23T12:11:49.748Z","repository":{"id":207629999,"uuid":"719714697","full_name":"mgernand/AspNetCore.Endpoints","owner":"mgernand","description":"Building and configuring object-oriented minimal API endpoints.","archived":true,"fork":false,"pushed_at":"2025-03-17T09:02:17.000Z","size":50,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T12:03:43.665Z","etag":null,"topics":["aspnetcore","endpoints","minimal-api","openapi","swagger"],"latest_commit_sha":null,"homepage":"","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/mgernand.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}},"created_at":"2023-11-16T18:43:25.000Z","updated_at":"2025-03-17T09:04:37.000Z","dependencies_parsed_at":"2023-11-16T20:55:32.887Z","dependency_job_id":"2fb35ac2-701e-4bc5-b374-6b2456f6c81d","html_url":"https://github.com/mgernand/AspNetCore.Endpoints","commit_stats":null,"previous_names":["mgernand/aspnetcore.endpoints"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.Endpoints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.Endpoints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.Endpoints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgernand%2FAspNetCore.Endpoints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgernand","download_url":"https://codeload.github.com/mgernand/AspNetCore.Endpoints/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250430585,"owners_count":21429324,"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","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":["aspnetcore","endpoints","minimal-api","openapi","swagger"],"created_at":"2024-11-29T07:26:04.168Z","updated_at":"2025-04-23T12:11:49.742Z","avatar_url":"https://github.com/mgernand.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AspNetCore.Endpoints\n\nA library that helps in building and configuring object-oriented minimal API endpoints.\n\n## This repository was moved to https://codeberg.org/mgernand/AspNetCore.Endpoints\n\nMapping every single minimal API endpoint in the ```Program.cs``` file can become \nconfusing very fast. For applications hosting a larger amount of endpoints this \nlibrary allows to implement an endpoint in a structured way. This endpoints will\nthen be automatically mapped, removing clutter from the ```Program.cs``` file.\n\nEverything related to and endpoint like the mapping and the implementation itself\nis encapsulated in a single class. The library offers a default way of naming groups\nand endpoints. The default convention for the group name an endpoint belongs to is\nthe last part of the namespace the endpoint belongs to. The default convention for\nthe endppoint name id the class name of the endpoint.\n\nThis default conventions can be overridden by using attributes athe endpoints class level.\n\n- ```[EndpointGroup(\"GroupName\")]```\n    \n    The name of the group this endpoint belongs to.\n\n- ```[EndpointName(\"SomeOtherName\")]```\n\n    The name of the endpoint.\n\n## Endpoints Usage\n\nEvery endpoint is implemented in it's own class, deriving from ```EndpointBase```. \nEndpoints are discovered from the available types using this base class.\n\n```C#\n\n\tpublic sealed class Get : EndpointBase\n\t{\n\t\t/// \u003cinheritdoc /\u003e\n\t\tpublic override void Map(IEndpointRouteBuilder endpoints)\n\t\t{\n\t\t\tendpoints\n\t\t\t\t.MapGet(this.Execute, \"{id}\")\n\t\t\t\t.AllowAnonymous()\n\t\t\t\t.Produces\u003cCustomer\u003e(200, \"application/json\");\n\t\t}\n\n\t\tpublic async Task\u003cIResult\u003e Execute(HttpContext httpContext, string id)\n\t\t{\n\t\t\treturn Results.Ok(new Customer\n\t\t\t{\n\t\t\t\tName = \"John Connor\"\n\t\t\t});\n\t\t}\n\t}\n\n```\n\nThe mapping and configuration of additional meta data configuration of the endpoint is done \nin the ```Map``` method. The actual endpoint implementation is done in the ```Execute``` method.\nThe name of the method free to choose, it doesn't affect the mapping of the endpoint in any way.\n\nTo allow the endpoint beeing automatically mapped one has to add this to the ```Program.cs```:\n\n```C#\n\napp.MapEndpoints();\n\n```\n\nThis it!\n\n## Additional Configuration\n\nThe endpoints are by default mapped under a global route prefix ```api```. To change this\ndefault value, one can configure the ```EndpointsOptions``` when configuring the application.\n\n```C#\n\n\tbuilder.Services.Configure\u003cEndpointsOptions\u003e(options =\u003e\n\t{\n\t\toptions.EndpointsRoutePrefix = \"endpoints\";\n\t\toptions.MapGroup = groupBuilder =\u003e\n\t\t{\n\t\t\tgroupBuilder.WithOpenApi();\n\t\t};\n\t});\n\n```\n\nIn this exampple the global route prefix for all enpoints is changed to ```endpoints``` and\nan additional endpoint group configuration is added using the ```MapGroup``` callback,\nwhich is called for every endpoint group.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgernand%2Faspnetcore.endpoints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgernand%2Faspnetcore.endpoints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgernand%2Faspnetcore.endpoints/lists"}