mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-05 00:37:21 +08:00
框架搭建
This commit is contained in:
28
src/Yi.Framework/Yi.Framework.Web/Program.cs
Normal file
28
src/Yi.Framework/Yi.Framework.Web/Program.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
using Yi.Framework.Core.Extensions;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.UseYiModules();
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:56921",
|
||||
"sslPort": 44346
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"Yi.Framework.Web": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7253;http://localhost:5109",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
src/Yi.Framework/Yi.Framework.Web/Yi.Framework.Web.csproj
Normal file
17
src/Yi.Framework/Yi.Framework.Web/Yi.Framework.Web.csproj
Normal file
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
18
src/Yi.Framework/Yi.Framework.Web/YiFrameworkWebModule.cs
Normal file
18
src/Yi.Framework/Yi.Framework.Web/YiFrameworkWebModule.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using StartupModules;
|
||||
using Yi.Framework.Core.Module;
|
||||
|
||||
namespace Yi.Framework.Web
|
||||
{
|
||||
public class YiFrameworkWebModule : IYiModule
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
|
||||
}
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
Console.WriteLine("还有谁");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/Yi.Framework/Yi.Framework.Web/appsettings.json
Normal file
9
src/Yi.Framework/Yi.Framework.Web/appsettings.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Reference in New Issue
Block a user