Skip to content

Commit

Permalink
fix use endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
nhathoang989 committed Aug 26, 2023
1 parent f31eb73 commit 53d7b22
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public static void UseMixMVCEndpoints(this IEndpointRouteBuilder routes)
{
string notStartWithPattern = "regex(^(?!(mix-app|graph|app|init|page|post|security|portal|api|vue|error|swagger|graphql|ReDoc|OpenAPI|.+Hub))(.+)$)";
//string urlPathPattern = @"regex((([A-z0-9\-\%]+\/)*[A-z0-9\-\%]+$)?)";

routes.MapDefaultControllerRoute();

routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
pattern: "{seoName:" + notStartWithPattern + "}");
routes.MapDynamicControllerRoute<MixSEORouteTransformer>(
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mix.account/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"IIS Express": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v2/mix-account/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand All @@ -21,7 +21,7 @@
"mix.account": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v2/mix-account/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mix.common/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/v2/mix-common/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"mix.common": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v2/mix-common/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mix.messenger/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"IIS Express": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v2/mix-messenger/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"mix.messenger": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v2/mix-messenger/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mix.portal/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/v2/mix-portal/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand All @@ -21,7 +21,7 @@
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "api/v2/mix-portal/swagger",
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5006;http://localhost:5007",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand Down
9 changes: 8 additions & 1 deletion src/modules/mix.portal/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Mix.Database.Entities.Account;
using Mix.Lib.Middlewares;
using Mix.Log;
using System.Reflection;

namespace Mix.Portal
Expand All @@ -18,14 +20,19 @@ public void ConfigureServices(IServiceCollection services)

services.AddMixServices(Assembly.GetExecutingAssembly(), Configuration);
services.AddMixCors();

services.AddMixLog(Configuration);
// Must app Auth config after Add mixservice to init App config
services.AddMixAuthorize<MixCmsAccountContext>(Configuration);
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseMixCors();
app.UseMixTenant();
app.UseMiddleware<AuditlogMiddleware>();
app.UseRouting();
app.UseMixAuth();
app.UseMixCors();
app.UseMixApps(Assembly.GetExecutingAssembly(), Configuration, env.ContentRootPath, env.IsDevelopment());
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mix.scheduler/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"IIS Express": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v2/mix-scheduler/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"mix.scheduler": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/v2/mix-scheduler/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand Down
4 changes: 2 additions & 2 deletions src/modules/mix.tenancy/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/v2/mix-tenancy/swagger",
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand All @@ -21,7 +21,7 @@
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "api/v2/mix-tenancy/swagger",
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5008;http://localhost:5009",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public static IApplicationBuilder UseMixApps(
app.ConfigureExceptionHandler();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
foreach (var assembly in MixAssemblies)
{
var startupServices = assembly.GetExportedTypes().Where(IsStartupService);
Expand Down

0 comments on commit 53d7b22

Please sign in to comment.