{"id":21616349,"url":"https://github.com/netcorestack/proxy","last_synced_at":"2025-04-11T07:33:45.682Z","repository":{"id":97713913,"uuid":"77337955","full_name":"NetCoreStack/Proxy","owner":"NetCoreStack","description":"The type-safe REST library for .NET Standard 2.0 (NetCoreStack Flying Proxy)","archived":false,"fork":false,"pushed_at":"2023-10-10T12:52:16.000Z","size":1122,"stargazers_count":43,"open_issues_count":0,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T05:04:14.699Z","etag":null,"topics":["backend","dotnet","http-client","load-balancer","proxy","rest-client","scalability"],"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/NetCoreStack.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}},"created_at":"2016-12-25T18:28:23.000Z","updated_at":"2025-02-05T14:23:19.000Z","dependencies_parsed_at":"2024-01-02T22:43:25.777Z","dependency_job_id":"35adcabf-5325-4280-9778-757bdf03b2de","html_url":"https://github.com/NetCoreStack/Proxy","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetCoreStack%2FProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetCoreStack%2FProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetCoreStack%2FProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetCoreStack%2FProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetCoreStack","download_url":"https://codeload.github.com/NetCoreStack/Proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248358842,"owners_count":21090442,"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":["backend","dotnet","http-client","load-balancer","proxy","rest-client","scalability"],"created_at":"2024-11-24T22:14:16.532Z","updated_at":"2025-04-11T07:33:45.648Z","avatar_url":"https://github.com/NetCoreStack.png","language":"C#","readme":"# NetCoreStack Proxy\n[![NuGet](https://img.shields.io/nuget/v/NetCoreStack.Proxy.svg?longCache=true\u0026style=flat-square)](https://www.nuget.org/packages/NetCoreStack.Proxy)\n[![NuGet](https://img.shields.io/nuget/dt/NetCoreStack.Proxy.svg?longCache=true\u0026style=flat-square)](https://www.nuget.org/packages/NetCoreStack.Proxy)\n\n\n### Cross-Platform .NET Standard HTTP Base Flying Proxy\n\nThis project is demonstrating manage and consume distributed HTTP APIs and Micro Services\nfrom different regions (hosts) with ease.\n\nFlying Proxy allows the management of scalable applications, trigger many operations at the same time from your clients (Desktop, Web or Mobile App) and start to consume your new resources that you can simply add.\n\nFlying Proxy aims to:\n- Simple scalability\n- Effective and type-safe management of distributed architecture\n- Better performance\n- Maintainability\n\n## Sample Client (Web)\n\n### Add ProxySettings section to the appsettings.json\n```json\n\"ProxySettings\": {\n    \"RegionKeys\": {\n        \"Main\": \"http://localhost:5000/,http://localhost:5001/\",\n        \"Authorization\": \"http://localhost:5002/\",\n        \"Integrations\": \"http://localhost:5003/\"\n    }\n}\n```\n\n### APIs Definitions\n```csharp\n// This API expose methods from localhost:5000 and localhost:5001 as configured on ProxySettings\n[ApiRoute(\"api/[controller]\", regionKey: \"Main\")]\npublic interface IGuidelineApi : IApiContract\n{\n    [HttpHeaders(\"X-Method-Header: Some Value\")]\n    Task TaskOperation();\n\n    int PrimitiveReturn(int i, string s, long l, DateTime dt);\n\n    Task\u003cIEnumerable\u003cSampleModel\u003e\u003e GetEnumerableModels();\n\n    Task GetWithReferenceType(SimpleModel model);\n\n    /// \u003csummary\u003e\n    /// Default Content-Type is ModelAware.\n    /// If the any parameter(s) has FormFile type property that will be MultipartFormData \n    /// if not will be JSON\n    /// \u003c/summary\u003e\n    /// \u003cparam name=\"model\"\u003e\u003c/param\u003e\n    /// \u003creturns\u003e\u003c/returns\u003e\n    [HttpPostMarker]\n    Task TaskActionPost(ComplexTypeModel model);\n\n    [HttpPostMarker(ContentType = ContentType.MultipartFormData)]\n    Task TaskActionBarMultipartFormData(Bar model);\n\n    [HttpPostMarker(ContentType = ContentType.Xml)]\n    Task TaskActionBarSimpleXml(BarSimple model);\n\n    /// \u003csummary\u003e\n    /// Template and parameter usage, key parameter will be part of the request Url \n    /// and extracting it as api/guideline/kv/\u003ckey\u003e\n    /// \u003c/summary\u003e\n    /// \u003cparam name=\"key\"\u003e\u003c/param\u003e\n    /// \u003cparam name=\"body\"\u003e\u003c/param\u003e\n    /// \u003creturns\u003e\u003c/returns\u003e\n    [HttpPutMarker(Template = \"kv/{key}\")]\n    Task\u003cbool\u003e CreateOrUpdateKey(string key, Bar body);\n}\n```\n\n### Startup ConfigureServices\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n    services.AddNetCoreProxy(Configuration, options =\u003e\n    {\n        // Register the API to use as a Proxy\n        options.Register\u003cIGuidelineApi\u003e();\n    });\n\n    // Add framework services.\n    services.AddMvc();\n}\n```\n\n### Proxy Usage (DI)\n```csharp\npublic class HomeController : Controller\n{\n    private readonly IGuidelineApi _api;\n\n    public TestController(IGuidelineApi api)\n    {\n        _api = api;\n    }\n\n    public async Task\u003cIEnumerable\u003cSampleModel\u003e\u003e GetModels()\n    {\n        var items = await _api.GetEnumerableModels();\n        return items;\n    }\n}\n```\n\n## Sample Server\n\n### API Implementation\n```csharp\n[Route(\"api/[controller]\")]\npublic class GuidelineController : Controller, IGuidelineApi\n{\n    [HttpGet(nameof(GetEnumerableModels))]\n    public Task\u003cIEnumerable\u003cSampleModel\u003e\u003e GetEnumerableModels()\n    {\n        ...\n        return items;\n    }\n\n    [HttpPost(nameof(TaskComplexTypeModel))]\n    public async Task TaskComplexTypeModel([FromBody]ComplexTypeModel model)\n    {\n        ...\n    }\n\n    [HttpPost(nameof(TaskActionBarMultipartFormData))]\n    public Task TaskActionBarMultipartFormData(Bar model)\n    {\n        ...\n    }\n\n    [HttpPut(\"kv\")]\n    public async Task\u003cbool\u003e CreateOrUpdateKey(string key, Bar body)\n    {\n        ...\n    }\n}\n```\n\n### Unit Testing\nUse [HttpLive](https://github.com/gencebay/httplive)\n\n\thttplive -p 5003,5004 -d test/NetCoreStack.Proxy.Tests/httplive.db\n\n[Latest release on Nuget](https://www.nuget.org/packages/NetCoreStack.Proxy/)\n\n### Prerequisites\n\u003e [ASP.NET Core](https://github.com/aspnet/Home)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetcorestack%2Fproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetcorestack%2Fproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetcorestack%2Fproxy/lists"}