diff --git a/PortBlog.API.sln b/PortBlog.API.sln new file mode 100644 index 0000000..3246ead --- /dev/null +++ b/PortBlog.API.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34701.34 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PortBlog.API", "PortBlog.API\PortBlog.API.csproj", "{2E50B5D7-56E2-4E89-8742-BB57FF4245F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2E50B5D7-56E2-4E89-8742-BB57FF4245F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E50B5D7-56E2-4E89-8742-BB57FF4245F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E50B5D7-56E2-4E89-8742-BB57FF4245F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E50B5D7-56E2-4E89-8742-BB57FF4245F9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B74EF3B9-68FB-42A1-9635-817DFB28CD9E} + EndGlobalSection +EndGlobal diff --git a/PortBlog.API/DbContexts/BlogContext.cs b/PortBlog.API/DbContexts/BlogContext.cs new file mode 100644 index 0000000..3a7ff3b --- /dev/null +++ b/PortBlog.API/DbContexts/BlogContext.cs @@ -0,0 +1,8 @@ +using Microsoft.EntityFrameworkCore; + +namespace PortBlog.API.DbContexts +{ + public class BlogContext : DbContext + { + } +} diff --git a/PortBlog.API/DbContexts/PortfolioContext.cs b/PortBlog.API/DbContexts/PortfolioContext.cs new file mode 100644 index 0000000..d4f8732 --- /dev/null +++ b/PortBlog.API/DbContexts/PortfolioContext.cs @@ -0,0 +1,8 @@ +using Microsoft.EntityFrameworkCore; + +namespace PortBlog.API.DbContexts +{ + public class PortfolioContext : DbContext + { + } +} diff --git a/PortBlog.API/PortBlog.API.csproj b/PortBlog.API/PortBlog.API.csproj new file mode 100644 index 0000000..e3acc73 --- /dev/null +++ b/PortBlog.API/PortBlog.API.csproj @@ -0,0 +1,25 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + diff --git a/PortBlog.API/Program.cs b/PortBlog.API/Program.cs new file mode 100644 index 0000000..c5985b9 --- /dev/null +++ b/PortBlog.API/Program.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore; +using PortBlog.API.DbContexts; +using Serilog; + +Log.Logger = new LoggerConfiguration() + .MinimumLevel.Debug() + .WriteTo.Console() + .WriteTo.File("logs/portblog.txt", rollingInterval: RollingInterval.Day) + .CreateLogger(); + +var builder = WebApplication.CreateBuilder(args); + +builder.Host.UseSerilog(); + +// Add services to the container. + +builder.Services.AddControllers(options => +{ + options.ReturnHttpNotAcceptable = true; +}).AddNewtonsoftJson(); + +builder.Services.AddProblemDetails(); + +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +builder.Services + .AddDbContext(dbContextOptions + => dbContextOptions.UseSqlite(builder.Configuration["ConnectionStrings:PortBlogDBConnectionString"])); + +builder.Services + .AddDbContext(dbContextOptions + => dbContextOptions.UseSqlite(builder.Configuration["ConnectionStrings:PortBlogDBConnectionString"])); + +var app = builder.Build(); + +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler(); +} + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/PortBlog.API/Properties/launchSettings.json b/PortBlog.API/Properties/launchSettings.json new file mode 100644 index 0000000..229725e --- /dev/null +++ b/PortBlog.API/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:37113", + "sslPort": 44357 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5039", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "PortBlog.API": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7013;http://localhost:5039", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/PortBlog.API/appsettings.Development.json b/PortBlog.API/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/PortBlog.API/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/PortBlog.API/appsettings.Production.json b/PortBlog.API/appsettings.Production.json new file mode 100644 index 0000000..ec04bc1 --- /dev/null +++ b/PortBlog.API/appsettings.Production.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} \ No newline at end of file diff --git a/PortBlog.API/appsettings.json b/PortBlog.API/appsettings.json new file mode 100644 index 0000000..bdf1af0 --- /dev/null +++ b/PortBlog.API/appsettings.json @@ -0,0 +1,12 @@ +{ + "ConnectionString": { + "PortBlogDBConnectionString": "Data Source=Database\\PortBlogDB.db" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Resume Database Design.docx b/Resume Database Design.docx new file mode 100644 index 0000000..215b341 Binary files /dev/null and b/Resume Database Design.docx differ