From bb119b1ac5a9f2fa382ea42af0e675cda2ad8051 Mon Sep 17 00:00:00 2001 From: Aymen TROUDI Date: Sat, 10 Aug 2024 04:11:09 +0200 Subject: [PATCH] Upgrade to .net 8.0 --- .github/workflows/ci.yml | 6 +- .gitignore | 3 + AppGateway/AppGateway.csproj | 4 +- AppGateway/AppGateway.http | 25 ++++++ AppGateway/Constants.cs | 10 +++ AppGateway/Program.cs | 6 +- AppGateway/Startup.cs | 55 ++++++++++--- AppGateway/appsettings.Development.json | 71 ----------------- AppGateway/appsettings.json | 77 ++++++++++++++++++- .../Controllers/CustomersController.cs | 49 ++++++------ .../CustomersMicroservice.csproj | 2 +- CustomersMicroservice/Models/Customer.cs | 16 ++-- CustomersMicroservice/Program.cs | 6 +- CustomersMicroservice/Startup.cs | 8 -- .../appsettings.Development.json | 1 - CustomersMicroservice/appsettings.json | 1 - OrdersMicroservice/Models/Order.cs | 20 ++--- OrdersMicroservice/Models/OrderLine.cs | 15 ++-- OrdersMicroservice/OrdersMicroservice.csproj | 2 +- OrdersMicroservice/Program.cs | 6 +- OrdersMicroservice/Startup.cs | 8 -- .../appsettings.Development.json | 1 - OrdersMicroservice/appsettings.json | 1 - .../Controllers/ProductsController.cs | 53 +++++++------ ProductsMicroservice/Models/Product.cs | 17 ++-- .../ProductsMicroservice.csproj | 2 +- ProductsMicroservice/Program.cs | 6 +- ProductsMicroservice/Startup.cs | 8 -- .../appsettings.Development.json | 1 - ProductsMicroservice/appsettings.json | 1 - README.md | 4 +- tye.yaml | 8 +- 32 files changed, 264 insertions(+), 229 deletions(-) create mode 100644 AppGateway/AppGateway.http create mode 100644 AppGateway/Constants.cs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31607fa..b9c8d36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.gitignore b/.gitignore index dfcfd56..e8f8fc6 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,6 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ + +#JetBrains +.idea/ diff --git a/AppGateway/AppGateway.csproj b/AppGateway/AppGateway.csproj index 02d359f..b579a96 100644 --- a/AppGateway/AppGateway.csproj +++ b/AppGateway/AppGateway.csproj @@ -1,11 +1,11 @@ - net6.0 + net8.0 - + diff --git a/AppGateway/AppGateway.http b/AppGateway/AppGateway.http new file mode 100644 index 0000000..b127752 --- /dev/null +++ b/AppGateway/AppGateway.http @@ -0,0 +1,25 @@ +### + +@LocalUrl = https://localhost:5000 + +### Get random-route + +GET {{LocalUrl}}/api +Accept: application/json + +### Get customers-route + +GET {{LocalUrl}}/customers +Accept: application/json + +### Get orders-route + +GET {{LocalUrl}}/orders +Accept: application/json + +### Get products-route + +GET {{LocalUrl}}/products +Accept: application/json + +### diff --git a/AppGateway/Constants.cs b/AppGateway/Constants.cs new file mode 100644 index 0000000..ff441ef --- /dev/null +++ b/AppGateway/Constants.cs @@ -0,0 +1,10 @@ +namespace AppGateway; + +public static class Constants +{ + public const string ReverseProxySectionName = "ReverseProxy"; + + public const string RateLimitingPolicyName = "RateLimiting"; + + public const string OutputCachePolicyName = "OutputCache"; +} \ No newline at end of file diff --git a/AppGateway/Program.cs b/AppGateway/Program.cs index 66015ad..f71e4a7 100644 --- a/AppGateway/Program.cs +++ b/AppGateway/Program.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; @@ -5,9 +6,10 @@ namespace AppGateway; public static class Program { - public static void Main(string[] args) + public static async Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + using var host = CreateHostBuilder(args).Build(); + await host.RunAsync(); } private static IHostBuilder CreateHostBuilder(string[] args) => diff --git a/AppGateway/Startup.cs b/AppGateway/Startup.cs index 2910999..bd6d31a 100644 --- a/AppGateway/Startup.cs +++ b/AppGateway/Startup.cs @@ -1,28 +1,51 @@ +using System; +using System.Threading.RateLimiting; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.HttpLogging; +using Microsoft.AspNetCore.RateLimiting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace AppGateway; -public class Startup +public class Startup(IConfiguration configuration) { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - public void ConfigureServices(IServiceCollection services) { services.AddControllers(); + services.AddHttpLogging(options => + { + options.LoggingFields = HttpLoggingFields.All; + options.CombineLogs = true; + }); + + services.AddOutputCache(options => + { + options.AddPolicy(Constants.OutputCachePolicyName, builder => + { + builder.Expire(TimeSpan.FromSeconds(1)); + }); + }); + + services.AddRateLimiter(rateLimiterOptions => + { + rateLimiterOptions.RejectionStatusCode = StatusCodes.Status429TooManyRequests; + rateLimiterOptions.AddFixedWindowLimiter(Constants.RateLimitingPolicyName, options => + { + options.PermitLimit = 5; + options.Window = TimeSpan.FromSeconds(10); + options.QueueLimit = 0; + options.QueueProcessingOrder = QueueProcessingOrder.OldestFirst; + }); + }); + services .AddReverseProxy() - .LoadFromConfig(Configuration.GetSection("ReverseProxy")); + .LoadFromConfig(configuration.GetSection(Constants.ReverseProxySectionName)); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) @@ -32,16 +55,24 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseDeveloperExceptionPage(); } - app.UseHttpsRedirection(); + app.UseHttpLogging(); + app.UseHttpsRedirection(); + app.UseRouting(); + + app.UseAuthentication(); app.UseAuthorization(); - + + app.UseOutputCache(); + + app.UseRateLimiter(); + app.UseEndpoints(endpoints => { endpoints.MapGet("", ctx => ctx.Response.WriteAsync("App Gateway")); - endpoints.MapReverseProxy(); + endpoints.MapReverseProxy().CacheOutput(Constants.OutputCachePolicyName); }); } } \ No newline at end of file diff --git a/AppGateway/appsettings.Development.json b/AppGateway/appsettings.Development.json index 043b352..b2dcdb6 100644 --- a/AppGateway/appsettings.Development.json +++ b/AppGateway/appsettings.Development.json @@ -2,78 +2,7 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } - }, - "ReverseProxy": { - "Routes": { - "random-route": { - "ClusterId": "random-cluster", - "Match": { - "Path": "/api/{**catchall}" - }, - "Transforms": [ - { - "PathRemovePrefix": "/api" - } - ] - }, - "customers-route": { - "ClusterId": "customers-cluster", - "Match": { - "Path": "/customers/{**catchall}" - } - }, - "orders-route": { - "ClusterId": "orders-cluster", - "Match": { - "Path": "/orders/{**catchall}" - } - }, - "products-route": { - "ClusterId": "products-cluster", - "Match": { - "Path": "/products/{**catchall}" - } - } - }, - "Clusters": { - "random-cluster": { - "LoadBalancingPolicy": "RoundRobin", - "Destinations": { - "random-cluster/destination1": { - "Address": "https://localhost:5010/api/customers" - }, - "random-cluster/destination2": { - "Address": "https://localhost:5020/api/orders" - }, - "random-cluster/destination3": { - "Address": "https://localhost:5030/api/products" - } - } - }, - "customers-cluster": { - "Destinations": { - "customers-cluster/destination1": { - "Address": "https://localhost:5010/api" - } - } - }, - "orders-cluster": { - "Destinations": { - "orders-cluster/destination1": { - "Address": "https://localhost:5020/api" - } - } - }, - "products-cluster": { - "Destinations": { - "products-cluster/destination1": { - "Address": "https://localhost:5030/api" - } - } - } - } } } diff --git a/AppGateway/appsettings.json b/AppGateway/appsettings.json index d9d9a9b..80de095 100644 --- a/AppGateway/appsettings.json +++ b/AppGateway/appsettings.json @@ -2,9 +2,82 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, - "AllowedHosts": "*" + "ReverseProxy": { + "Routes": { + "random-route": { + "ClusterId": "random-cluster", + "RateLimiterPolicy": "RateLimiting", + "Match": { + "Path": "/api/{**catch-all}", + "Methods": [ "GET" ] + }, + "Transforms": [ + { + "PathRemovePrefix": "/api" + } + ] + }, + "customers-route": { + "ClusterId": "customers-cluster", + "Match": { + "Path": "/customers/{**catch-all}", + "Methods": [ "GET" ] + } + }, + "orders-route": { + "ClusterId": "orders-cluster", + "Match": { + "Path": "/orders/{**catch-all}", + "Methods": [ "GET" ] + } + }, + "products-route": { + "ClusterId": "products-cluster", + "Match": { + "Path": "/products/{**catch-all}", + "Methods": [ "GET" ] + } + } + }, + "Clusters": { + "random-cluster": { + "LoadBalancingPolicy": "RoundRobin", + "Destinations": { + "random-cluster/destination1": { + "Address": "https://localhost:5010/api/customers" + }, + "random-cluster/destination2": { + "Address": "https://localhost:5020/api/orders" + }, + "random-cluster/destination3": { + "Address": "https://localhost:5030/api/products" + } + } + }, + "customers-cluster": { + "Destinations": { + "customers-cluster/destination1": { + "Address": "https://localhost:5010/api" + } + } + }, + "orders-cluster": { + "Destinations": { + "orders-cluster/destination1": { + "Address": "https://localhost:5020/api" + } + } + }, + "products-cluster": { + "Destinations": { + "products-cluster/destination1": { + "Address": "https://localhost:5030/api" + } + } + } + } + } } diff --git a/CustomersMicroservice/Controllers/CustomersController.cs b/CustomersMicroservice/Controllers/CustomersController.cs index d5e48e5..2f26a9d 100644 --- a/CustomersMicroservice/Controllers/CustomersController.cs +++ b/CustomersMicroservice/Controllers/CustomersController.cs @@ -5,34 +5,33 @@ using System.Linq; using CustomersMicroservice.Models; -namespace CustomersMicroservice.Controllers +namespace CustomersMicroservice.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class CustomersController : ControllerBase { - [ApiController] - [Route("api/[controller]")] - public class CustomersController : ControllerBase + private static readonly string[] Customers = new[] { - private static readonly string[] Customers = new[] - { - "Walter White", "John Travolta", "Sofia Antipolis" - }; + "Walter White", "John Travolta", "Sofia Antipolis" + }; - private readonly ILogger _logger; + private readonly ILogger _logger; - public CustomersController(ILogger logger) - { - _logger = logger; - } + public CustomersController(ILogger logger) + { + _logger = logger; + } - [HttpGet] - public IEnumerable GetCustomers() - { - return Enumerable.Range(1, Customers.Length) - .Select(index => new Customer - { - CustomerId = index, - FullName = Customers[index-1], - Age = Random.Shared.Next(20, 80) - }).ToArray(); - } + [HttpGet] + public IEnumerable GetCustomers() + { + return Enumerable.Range(1, Customers.Length) + .Select(index => new Customer + { + CustomerId = index, + FullName = Customers[index-1], + Age = Random.Shared.Next(20, 80) + }).ToArray(); } -} +} \ No newline at end of file diff --git a/CustomersMicroservice/CustomersMicroservice.csproj b/CustomersMicroservice/CustomersMicroservice.csproj index e948168..d1e4d6e 100644 --- a/CustomersMicroservice/CustomersMicroservice.csproj +++ b/CustomersMicroservice/CustomersMicroservice.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 diff --git a/CustomersMicroservice/Models/Customer.cs b/CustomersMicroservice/Models/Customer.cs index 2494f39..15fdc55 100644 --- a/CustomersMicroservice/Models/Customer.cs +++ b/CustomersMicroservice/Models/Customer.cs @@ -1,10 +1,8 @@ -namespace CustomersMicroservice.Models -{ - public class Customer - { - public int CustomerId { get; set; } +namespace CustomersMicroservice.Models; - public string FullName { get; set; } - public int Age { get; set; } - } -} +public sealed record Customer +{ + public int CustomerId { get; init; } + public string FullName { get; init; } + public int Age { get; init; } +} \ No newline at end of file diff --git a/CustomersMicroservice/Program.cs b/CustomersMicroservice/Program.cs index 532cc4f..b687b87 100644 --- a/CustomersMicroservice/Program.cs +++ b/CustomersMicroservice/Program.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; @@ -5,9 +6,10 @@ namespace CustomersMicroservice; public static class Program { - public static void Main(string[] args) + public static async Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + using var host = CreateHostBuilder(args).Build(); + await host.RunAsync(); } private static IHostBuilder CreateHostBuilder(string[] args) => diff --git a/CustomersMicroservice/Startup.cs b/CustomersMicroservice/Startup.cs index d41724e..9d95739 100644 --- a/CustomersMicroservice/Startup.cs +++ b/CustomersMicroservice/Startup.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -9,13 +8,6 @@ namespace CustomersMicroservice; public class Startup { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - public void ConfigureServices(IServiceCollection services) { services.AddControllers(); diff --git a/CustomersMicroservice/appsettings.Development.json b/CustomersMicroservice/appsettings.Development.json index 8983e0f..b2dcdb6 100644 --- a/CustomersMicroservice/appsettings.Development.json +++ b/CustomersMicroservice/appsettings.Development.json @@ -2,7 +2,6 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } } diff --git a/CustomersMicroservice/appsettings.json b/CustomersMicroservice/appsettings.json index d9d9a9b..45d2555 100644 --- a/CustomersMicroservice/appsettings.json +++ b/CustomersMicroservice/appsettings.json @@ -2,7 +2,6 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, diff --git a/OrdersMicroservice/Models/Order.cs b/OrdersMicroservice/Models/Order.cs index 2400d29..a317833 100644 --- a/OrdersMicroservice/Models/Order.cs +++ b/OrdersMicroservice/Models/Order.cs @@ -1,16 +1,12 @@ using System; using System.Collections.Generic; -namespace OrdersMicroservice.Models -{ - public class Order - { - public int OrderId { get; set; } - - public int CustomerId { get; set; } +namespace OrdersMicroservice.Models; - public DateTime OrderDate { get; set; } - - public ICollection OrderLines { get; set; } - } -} +public sealed record Order +{ + public int OrderId { get; init; } + public int CustomerId { get; init; } + public DateTime OrderDate { get; init; } + public ICollection OrderLines { get; init; } +} \ No newline at end of file diff --git a/OrdersMicroservice/Models/OrderLine.cs b/OrdersMicroservice/Models/OrderLine.cs index 3ad9ae0..b7acbd5 100644 --- a/OrdersMicroservice/Models/OrderLine.cs +++ b/OrdersMicroservice/Models/OrderLine.cs @@ -1,11 +1,8 @@ -namespace OrdersMicroservice.Models -{ - public class OrderLine - { - public int OrderLineId { get; set; } - - public int ProductId { get; set; } +namespace OrdersMicroservice.Models; - public int Quantity { get; set; } - } +public sealed record OrderLine +{ + public int OrderLineId { get; init; } + public int ProductId { get; init; } + public int Quantity { get; init; } } \ No newline at end of file diff --git a/OrdersMicroservice/OrdersMicroservice.csproj b/OrdersMicroservice/OrdersMicroservice.csproj index e948168..d1e4d6e 100644 --- a/OrdersMicroservice/OrdersMicroservice.csproj +++ b/OrdersMicroservice/OrdersMicroservice.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 diff --git a/OrdersMicroservice/Program.cs b/OrdersMicroservice/Program.cs index 0394e1a..98b8298 100644 --- a/OrdersMicroservice/Program.cs +++ b/OrdersMicroservice/Program.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; @@ -5,9 +6,10 @@ namespace OrdersMicroservice; public static class Program { - public static void Main(string[] args) + public static async Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + using var host = CreateHostBuilder(args).Build(); + await host.RunAsync(); } private static IHostBuilder CreateHostBuilder(string[] args) => diff --git a/OrdersMicroservice/Startup.cs b/OrdersMicroservice/Startup.cs index 6ef086d..602c68e 100644 --- a/OrdersMicroservice/Startup.cs +++ b/OrdersMicroservice/Startup.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -9,13 +8,6 @@ namespace OrdersMicroservice; public class Startup { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - public void ConfigureServices(IServiceCollection services) { services.AddControllers(); diff --git a/OrdersMicroservice/appsettings.Development.json b/OrdersMicroservice/appsettings.Development.json index 8983e0f..b2dcdb6 100644 --- a/OrdersMicroservice/appsettings.Development.json +++ b/OrdersMicroservice/appsettings.Development.json @@ -2,7 +2,6 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } } diff --git a/OrdersMicroservice/appsettings.json b/OrdersMicroservice/appsettings.json index d9d9a9b..45d2555 100644 --- a/OrdersMicroservice/appsettings.json +++ b/OrdersMicroservice/appsettings.json @@ -2,7 +2,6 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, diff --git a/ProductsMicroservice/Controllers/ProductsController.cs b/ProductsMicroservice/Controllers/ProductsController.cs index 03f50db..b5e8739 100644 --- a/ProductsMicroservice/Controllers/ProductsController.cs +++ b/ProductsMicroservice/Controllers/ProductsController.cs @@ -5,35 +5,34 @@ using System.Linq; using ProductsMicroservice.Models; -namespace ProductsMicroservice.Controllers +namespace ProductsMicroservice.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class ProductsController : ControllerBase { - [ApiController] - [Route("api/[controller]")] - public class ProductsController : ControllerBase - { - private readonly ILogger _logger; + private readonly ILogger _logger; - private static readonly string[] Products = new[] - { - "Pc", "Phone", "Tv" - }; + private static readonly string[] Products = new[] + { + "Pc", "Phone", "Tv" + }; - public ProductsController(ILogger logger) - { - _logger = logger; - } + public ProductsController(ILogger logger) + { + _logger = logger; + } - [HttpGet] - public IEnumerable GetProducts() - { - var rng = new Random(Guid.NewGuid().GetHashCode()); - return Enumerable.Range(1, Products.Length) - .Select(index => new Product - { - ProductId = index, - Name = Products[index-1], - Price = rng.Next(10, 100) - }).ToArray(); - } + [HttpGet] + public IEnumerable GetProducts() + { + var rng = new Random(Guid.NewGuid().GetHashCode()); + return Enumerable.Range(1, Products.Length) + .Select(index => new Product + { + ProductId = index, + Name = Products[index-1], + Price = rng.Next(10, 100) + }).ToArray(); } -} +} \ No newline at end of file diff --git a/ProductsMicroservice/Models/Product.cs b/ProductsMicroservice/Models/Product.cs index 1fd934d..8fbe4ea 100644 --- a/ProductsMicroservice/Models/Product.cs +++ b/ProductsMicroservice/Models/Product.cs @@ -1,11 +1,8 @@ -namespace ProductsMicroservice.Models -{ - public class Product - { - public int ProductId { get; set; } - - public string Name { get; set; } +namespace ProductsMicroservice.Models; - public decimal Price { get; set; } - } -} +public sealed record Product +{ + public int ProductId { get; init; } + public string Name { get; init; } + public decimal Price { get; init; } +} \ No newline at end of file diff --git a/ProductsMicroservice/ProductsMicroservice.csproj b/ProductsMicroservice/ProductsMicroservice.csproj index 2ab1f77..fdb505d 100644 --- a/ProductsMicroservice/ProductsMicroservice.csproj +++ b/ProductsMicroservice/ProductsMicroservice.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 diff --git a/ProductsMicroservice/Program.cs b/ProductsMicroservice/Program.cs index 7c31e3b..8d3fa2f 100644 --- a/ProductsMicroservice/Program.cs +++ b/ProductsMicroservice/Program.cs @@ -1,3 +1,4 @@ +using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; @@ -5,9 +6,10 @@ namespace ProductsMicroservice; public static class Program { - public static void Main(string[] args) + public static async Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + using var host = CreateHostBuilder(args).Build(); + await host.RunAsync(); } private static IHostBuilder CreateHostBuilder(string[] args) => diff --git a/ProductsMicroservice/Startup.cs b/ProductsMicroservice/Startup.cs index c7f8f48..4a23763 100644 --- a/ProductsMicroservice/Startup.cs +++ b/ProductsMicroservice/Startup.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -9,13 +8,6 @@ namespace ProductsMicroservice; public class Startup { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - public void ConfigureServices(IServiceCollection services) { services.AddControllers(); diff --git a/ProductsMicroservice/appsettings.Development.json b/ProductsMicroservice/appsettings.Development.json index 8983e0f..b2dcdb6 100644 --- a/ProductsMicroservice/appsettings.Development.json +++ b/ProductsMicroservice/appsettings.Development.json @@ -2,7 +2,6 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } } diff --git a/ProductsMicroservice/appsettings.json b/ProductsMicroservice/appsettings.json index d9d9a9b..45d2555 100644 --- a/ProductsMicroservice/appsettings.json +++ b/ProductsMicroservice/appsettings.json @@ -2,7 +2,6 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, diff --git a/README.md b/README.md index 523bf63..7336ff5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Playing with Yarp reverse proxy > In this demo, i m using [Yarp](https://microsoft.github.io/reverse-proxy) in order to build a lightweight app gateway intercepting requests and redirecting them to backend microservices. > -> The solution is organized as follow : +> The solution is organized as follows : > > - `AppGateway` : a webapi with yarp integration and configuration > - `CustomersMicroservice` : a webapi listing fake customers @@ -27,4 +27,4 @@ Playing with Yarp reverse proxy > ![TyeDashboard](Screenshots/TyeDashboard.png) > -**`Tools`** : net 6.0, tye, yarp \ No newline at end of file +**`Tools`** : net 8.0, yarp, tye \ No newline at end of file diff --git a/tye.yaml b/tye.yaml index b156666..a867ba5 100644 --- a/tye.yaml +++ b/tye.yaml @@ -6,22 +6,22 @@ # name: yarpdemo services: -- name: appgateway +- name: app-gateway project: AppGateway/AppGateway.csproj bindings: - port: 5000 protocol: https -- name: customersmicroservice +- name: customers-microservice project: CustomersMicroservice/CustomersMicroservice.csproj bindings: - port: 5010 protocol: https -- name: ordersmicroservice +- name: orders-microservice project: OrdersMicroservice/OrdersMicroservice.csproj bindings: - port: 5020 protocol: https -- name: productsmicroservice +- name: products-microservice project: ProductsMicroservice/ProductsMicroservice.csproj bindings: - port: 5030