CoreWork.Gateway
1.1.1
dotnet add package CoreWork.Gateway --version 1.1.1
NuGet\Install-Package CoreWork.Gateway -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoreWork.Gateway" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreWork.Gateway" Version="1.1.1" />
<PackageReference Include="CoreWork.Gateway" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CoreWork.Gateway --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CoreWork.Gateway, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=CoreWork.Gateway&version=1.1.1
#tool nuget:?package=CoreWork.Gateway&version=1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CoreWork.Gateway Version:1.0.0
/// <summary>
/// Adds gateway to container
/// </summary>
/// <param name="services"></param>
/// <param name="configuration"></param>
public static void AddGateway(this IServiceCollection services, IConfiguration configuration)
{
services.AddOcelot(configuration);
}
/// <summary>
/// Adds ocelot to request pipeline
/// </summary>
/// <param name="app"></param>
/// <returns></returns>
public static async Task UseGateway(this IApplicationBuilder app)
{
await app.UseOcelot();
}
/// <summary>
/// Adds and configures gateway
/// </summary>
/// <param name="hostBuilder"></param>
/// <param name="hostingContext"></param>
/// <param name="config"></param>
public static void ConfigureGatewayConfiguration(this IHostBuilder hostBuilder, HostBuilderContext hostingContext, IConfigurationBuilder config)
{
hostBuilder.ConfigureAppConfiguration((hostingContext, config) => { config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath).AddJsonFile("configuration.json", optional: false, reloadOnChange: true); });
}
USAGE:
services.AddGateway(Configuration);
await app.UseGateway();
hostBuilder.ConfigureGatewayConfiguration()
!!!Now we have to create file like 'configuration.json'. In this file, we will map our microservice URLs with our ocelot application URLs!!!
The 'Routes' property is an array type where we are going to add our URL mappings.
The 'DownstreamPathTeplate' is our microservice endpoint.
The 'DownstreamSchem' is our microservice is 'HTTPS' or 'HTTP'.
The 'DownstreamHostAndPorts' where we have to define our microservice HostName and PortNumber.
The 'UpStreamPathTemplate' is ocelot URL which is an alia URL for our 'DownStreamPathTemlate'.
The 'UpstreamHttpMethod' specifies the supported methods.
******configuration.json******
{
"Routes": [
{
"DownstreamPathTemplate": "Test.Service/healthcheck",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 80
}
],
"UpstreamPathTemplate": "/healthcheck",
"UpstreamHttpMethod": [ "Get", "Post" ]
}
],
"GlobalConfiguration": {}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Ocelot (>= 18.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.