-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from amirhossein18121380/fix-module-structure
- Loading branch information
Showing
29 changed files
with
689 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using Booking; | ||
using BuildingBlocks.CAP; | ||
using BuildingBlocks.Domain; | ||
using BuildingBlocks.Exception; | ||
using BuildingBlocks.Jwt; | ||
using BuildingBlocks.Logging; | ||
using BuildingBlocks.MediatR; | ||
using BuildingBlocks.Swagger; | ||
using BuildingBlocks.Web; | ||
using Figgle; | ||
using Hellang.Middleware.ProblemDetails; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc.ApiExplorer; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Serilog; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
var configuration = builder.Configuration; | ||
var env = builder.Environment; | ||
|
||
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions"); | ||
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name)); | ||
|
||
builder.AddCustomSerilog(env); | ||
builder.Services.AddJwt(); | ||
builder.Services.AddControllers(); | ||
builder.Services.AddHttpContextAccessor(); | ||
|
||
builder.Services.AddCustomCap(); | ||
builder.Services.AddTransient<IBusPublisher, BusPublisher>(); | ||
builder.Services.AddCustomVersioning(); | ||
|
||
builder.Services.AddCustomSwagger(configuration, | ||
typeof(BookingRoot).Assembly); | ||
|
||
builder.Services.AddCustomProblemDetails(); | ||
|
||
builder.Services.AddBookingModules(configuration); | ||
|
||
builder.Services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); }); | ||
|
||
builder.Services.AddCustomMediatR( | ||
typeof(BookingRoot).Assembly | ||
); | ||
|
||
var app = builder.Build(); | ||
|
||
if (app.Environment.IsDevelopment()) | ||
{ | ||
var provider = app.Services.GetService<IApiVersionDescriptionProvider>(); | ||
app.UseCustomSwagger(provider); | ||
} | ||
|
||
app.UseSerilogRequestLogging(); | ||
app.UseCorrelationId(); | ||
app.UseRouting(); | ||
app.UseAuthentication(); | ||
app.UseAuthorization(); | ||
app.UseHttpsRedirection(); | ||
|
||
app.UseBookingModules(); | ||
app.UseProblemDetails(); | ||
|
||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); | ||
|
||
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name)); | ||
|
||
app.Run(); |
31 changes: 31 additions & 0 deletions
31
src/Modules/Booking/src/Booking/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:17192", | ||
"sslPort": 44353 | ||
} | ||
}, | ||
"profiles": { | ||
"Booking": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchUrl": "swagger", | ||
"launchBrowser": true, | ||
"applicationUrl": "https://localhost:5002;http://localhost:5003", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"IIS Express": { | ||
"commandName": "IISExpress", | ||
"launchBrowser": true, | ||
"launchUrl": "swagger", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"AppOptions": { | ||
"Name": "Booking-Modular-Monolith" | ||
}, | ||
"LogOptions": { | ||
"Level": "information", | ||
"LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}", | ||
"Elastic": { | ||
"Enabled": true, | ||
"ElasticServiceUrl": "http://localhost:9200" | ||
}, | ||
"File": { | ||
"Enabled": false, | ||
"Path": "logs/logs.txt", | ||
"Interval": "day" | ||
}, | ||
"Sentry": { | ||
"Enabled": false, | ||
"Dsn": "", | ||
"MinimumBreadcrumbLevel": "information", | ||
"MinimumEventLevel": "error" | ||
} | ||
}, | ||
"ConnectionStrings": { | ||
"Booking": "Server=.\\sqlexpress;Database=BookingDB-Monolith;Trusted_Connection=True;MultipleActiveResultSets=true", | ||
"Flight": "Server=.\\sqlexpress;Database=FlightDB-Monolith;Trusted_Connection=True;MultipleActiveResultSets=true", | ||
"Passenger":"Server=.\\sqlexpress;Database=PassengerDB-Monolith;Trusted_Connection=True;MultipleActiveResultSets=true", | ||
"Identity": "Server=.\\sqlexpress;Database=IdentityDB-Monolith;Trusted_Connection=True;MultipleActiveResultSets=true" | ||
}, | ||
"Jwt": { | ||
"Authority": "https://localhost:5000", | ||
"Audience": "booking" | ||
}, | ||
"Grpc": { | ||
"FlightAddress": "https://localhost:5000", | ||
"PassengerAddress": "https://localhost:5000" | ||
}, | ||
"EventStore": { | ||
"ConnectionString": "esdb://localhost:2113?tls=false" | ||
}, | ||
"PersistMessageOptions": { | ||
"Interval": 30, | ||
"Enabled": true | ||
}, | ||
"AllowedHosts": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using BuildingBlocks.CAP; | ||
using BuildingBlocks.Domain; | ||
using BuildingBlocks.Exception; | ||
using BuildingBlocks.Jwt; | ||
using BuildingBlocks.Logging; | ||
using BuildingBlocks.MediatR; | ||
using BuildingBlocks.Swagger; | ||
using BuildingBlocks.Web; | ||
using Figgle; | ||
using Flight; | ||
using Hellang.Middleware.ProblemDetails; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc.ApiExplorer; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Serilog; | ||
using System; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
var configuration = builder.Configuration; | ||
var env = builder.Environment; | ||
|
||
var appOptions = builder.Services.GetOptions<AppOptions>("AppOptions"); | ||
Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name)); | ||
|
||
builder.AddCustomSerilog(env); | ||
builder.Services.AddJwt(); | ||
builder.Services.AddControllers(); | ||
builder.Services.AddHttpContextAccessor(); | ||
|
||
builder.Services.AddCustomCap(); | ||
builder.Services.AddTransient<IBusPublisher, BusPublisher>(); | ||
builder.Services.AddCustomVersioning(); | ||
|
||
builder.Services.AddCustomSwagger(configuration, | ||
typeof(FlightRoot).Assembly); | ||
|
||
builder.Services.AddCustomProblemDetails(); | ||
|
||
builder.Services.AddFlightModules(configuration); | ||
|
||
builder.Services.AddEasyCaching(options => { options.UseInMemory(configuration, "mem"); }); | ||
|
||
builder.Services.AddCustomMediatR( | ||
typeof(FlightRoot).Assembly | ||
); | ||
|
||
var app = builder.Build(); | ||
|
||
if (app.Environment.IsDevelopment()) | ||
{ | ||
var provider = app.Services.GetService<IApiVersionDescriptionProvider>(); | ||
app.UseCustomSwagger(provider); | ||
} | ||
|
||
app.UseSerilogRequestLogging(); | ||
app.UseCorrelationId(); | ||
app.UseRouting(); | ||
app.UseAuthentication(); | ||
app.UseAuthorization(); | ||
app.UseHttpsRedirection(); | ||
|
||
app.UseFlightModules(); | ||
|
||
|
||
app.UseProblemDetails(); | ||
|
||
app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); | ||
|
||
app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name)); | ||
|
||
app.Run(); |
Oops, something went wrong.