{"id":21988792,"url":"https://github.com/jmsfernandes/endpointdefinitions","last_synced_at":"2026-04-11T22:04:29.763Z","repository":{"id":65379943,"uuid":"508616462","full_name":"jmSfernandes/EndPointDefinitions","owner":"jmSfernandes","description":"A library to enable the easy definition of endpoints with .NET6 minimal API projects.","archived":false,"fork":false,"pushed_at":"2023-11-16T14:45:43.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-27T00:41:59.321Z","etag":null,"topics":["csharp","dotnet","minimal-apis","nuget"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmSfernandes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-06-29T08:54:11.000Z","updated_at":"2022-07-01T10:09:59.000Z","dependencies_parsed_at":"2024-11-29T19:28:36.496Z","dependency_job_id":"261c8160-b892-46f5-869a-373e8b535264","html_url":"https://github.com/jmSfernandes/EndPointDefinitions","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmSfernandes%2FEndPointDefinitions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmSfernandes%2FEndPointDefinitions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmSfernandes%2FEndPointDefinitions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmSfernandes%2FEndPointDefinitions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmSfernandes","download_url":"https://codeload.github.com/jmSfernandes/EndPointDefinitions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245048277,"owners_count":20552483,"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":["csharp","dotnet","minimal-apis","nuget"],"created_at":"2024-11-29T19:22:41.749Z","updated_at":"2026-04-11T22:04:29.757Z","avatar_url":"https://github.com/jmSfernandes.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EndPointDefinitions\n[![Nuget badge](https://img.shields.io/nuget/v/MinimalApi.EndPointDefinitions)](https://www.nuget.org/packages/MinimalApi.EndPointDefinitions/1.0.0)\n[![Nuget badge](https://img.shields.io/nuget/dt/MinimalApi.EndPointDefinitions)](https://www.nuget.org/packages/MinimalApi.EndPointDefinitions/1.0.0)\n\n\nA library to enable the easy definition of endpoints with .NET10 minimal API projects.\n\nTo use import the project from [nuget](https://www.nuget.org/packages/MinimalApi.EndPointDefinitions/1.0.0).\n\nA full example of how to use the library is available in this [project](https://github.com/jmSfernandes/ExampleEndpointDefinitions).\n\n## Using the library:\n\nDefining an Endpoint:\n```C#\n\npublic class WeatherEndpoint : IEndpointDefinition\n{\n    public void DefineServices(IServiceCollection services)\n    {\n        //Define services here\n        services.AddScoped\u003cIWeatherService, WeatherService\u003e();\n    }\n\n    public void DefineEndpoints(WebApplication app)\n    {\n        app.MapGet(\"/weatherforecast\", GetWeatherForecast)\n            .WithName(\"GetWeatherForecast\");\n    }\n...\n\n}\n\n```\n\nTo define an Endpoint you need to implement the `IEndpointDefinition` interface, and override both of the methods showed.\n\nYou do not need to use Services, you can define the GetWeatherForecast as a lambda or a extracted method within the Endpoint Class.\n\nThe example serves only to show that it is possible to use services and dependency injection with the library. \n\nAnd you have full control to still define your services lifecycle.\n\n**You can check the full example [project](https://github.com/jmSfernandes/ExampleEndpointDefinitions) to see the full implementation**.\n\n\nThen you only need to call the `Services.AddAllEndpointDefinitions` or the `Services.AddEndpointDefinition(Type type)` to define the \nendpoints. \n\nAnd the `app.UseEndpointDefinitions()` to start the Endpoints.\n\nAs shown here:\n\n```C#\n\nbuilder.Services.AddAllEndpointDefinitions();\n\n//its also possible to filter for specific endpointDefinitions\n//builder.Services.AddEndpointDefinitions(typeof(WeatherEndpoint));\n...\n\nvar app = builder.Build();\n\n...\n\n//Start Endpoint definitions\napp.UseEndpointDefinitions();\napp.Run();\n```\n\n\n## LICENSE \nMIT License\n\nCopyright (c) 2022 J. Fernandes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmsfernandes%2Fendpointdefinitions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmsfernandes%2Fendpointdefinitions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmsfernandes%2Fendpointdefinitions/lists"}