commit 157258882c54324cffaaff0f6a4c7458ebbb2ebd Author: jvyden Date: Tue Oct 5 23:02:13 2021 -0400 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..add57be7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ \ No newline at end of file diff --git a/.idea/.idea.ProjectLighthouse/.idea/discord.xml b/.idea/.idea.ProjectLighthouse/.idea/discord.xml new file mode 100644 index 00000000..30bab2ab --- /dev/null +++ b/.idea/.idea.ProjectLighthouse/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProjectLighthouse/.idea/encodings.xml b/.idea/.idea.ProjectLighthouse/.idea/encodings.xml new file mode 100644 index 00000000..df87cf95 --- /dev/null +++ b/.idea/.idea.ProjectLighthouse/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.ProjectLighthouse/.idea/indexLayout.xml b/.idea/.idea.ProjectLighthouse/.idea/indexLayout.xml new file mode 100644 index 00000000..7b08163c --- /dev/null +++ b/.idea/.idea.ProjectLighthouse/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProjectLighthouse/.idea/misc.xml b/.idea/.idea.ProjectLighthouse/.idea/misc.xml new file mode 100644 index 00000000..1d8c84d0 --- /dev/null +++ b/.idea/.idea.ProjectLighthouse/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProjectLighthouse/.idea/projectSettingsUpdater.xml b/.idea/.idea.ProjectLighthouse/.idea/projectSettingsUpdater.xml new file mode 100644 index 00000000..4bb9f4d2 --- /dev/null +++ b/.idea/.idea.ProjectLighthouse/.idea/projectSettingsUpdater.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.ProjectLighthouse/.idea/vcs.xml b/.idea/.idea.ProjectLighthouse/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/.idea.ProjectLighthouse/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ProjectLighthouse.sln b/ProjectLighthouse.sln new file mode 100644 index 00000000..12322461 --- /dev/null +++ b/ProjectLighthouse.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectLighthouse", "ProjectLighthouse\ProjectLighthouse.csproj", "{C6CFD4AD-47ED-4C86-B0C4-A4216D82E0DC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C6CFD4AD-47ED-4C86-B0C4-A4216D82E0DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6CFD4AD-47ED-4C86-B0C4-A4216D82E0DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6CFD4AD-47ED-4C86-B0C4-A4216D82E0DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6CFD4AD-47ED-4C86-B0C4-A4216D82E0DC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/ProjectLighthouse/.dockerignore b/ProjectLighthouse/.dockerignore new file mode 100644 index 00000000..cd967fc3 --- /dev/null +++ b/ProjectLighthouse/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/ProjectLighthouse/Controllers/WeatherForecastController.cs b/ProjectLighthouse/Controllers/WeatherForecastController.cs new file mode 100644 index 00000000..62410f79 --- /dev/null +++ b/ProjectLighthouse/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace ProjectLighthouse.Controllers { + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase { + private static readonly string[] Summaries = new[] { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) { + _logger = logger; + } + + [HttpGet] + public IEnumerable Get() { + var rng = new Random(); + return Enumerable.Range(1, 5).Select(index => new WeatherForecast { + Date = DateTime.Now.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Dockerfile b/ProjectLighthouse/Dockerfile new file mode 100644 index 00000000..3cbdb7a1 --- /dev/null +++ b/ProjectLighthouse/Dockerfile @@ -0,0 +1,20 @@ +FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["ProjectLighthouse/ProjectLighthouse.csproj", "ProjectLighthouse/"] +RUN dotnet restore "ProjectLighthouse/ProjectLighthouse.csproj" +COPY . . +WORKDIR "/src/ProjectLighthouse" +RUN dotnet build "ProjectLighthouse.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "ProjectLighthouse.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "ProjectLighthouse.dll"] diff --git a/ProjectLighthouse/Program.cs b/ProjectLighthouse/Program.cs new file mode 100644 index 00000000..a7d7791b --- /dev/null +++ b/ProjectLighthouse/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace ProjectLighthouse { + public class Program { + public static void Main(string[] args) { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => { + webBuilder.UseStartup(); + }); + } +} \ No newline at end of file diff --git a/ProjectLighthouse/ProjectLighthouse.csproj b/ProjectLighthouse/ProjectLighthouse.csproj new file mode 100644 index 00000000..c33c9b6b --- /dev/null +++ b/ProjectLighthouse/ProjectLighthouse.csproj @@ -0,0 +1,12 @@ + + + + net5.0 + Linux + + + + + + + diff --git a/ProjectLighthouse/Properties/launchSettings.json b/ProjectLighthouse/Properties/launchSettings.json new file mode 100644 index 00000000..9db7edf5 --- /dev/null +++ b/ProjectLighthouse/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:43904", + "sslPort": 44364 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "ProjectLighthouse": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/ProjectLighthouse/Startup.cs b/ProjectLighthouse/Startup.cs new file mode 100644 index 00000000..1924fdb0 --- /dev/null +++ b/ProjectLighthouse/Startup.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.HttpsPolicy; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; + +namespace ProjectLighthouse { + public class Startup { + public Startup(IConfiguration configuration) { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) { + + services.AddControllers(); + services.AddSwaggerGen(c => { + c.SwaggerDoc("v1", new OpenApiInfo { Title = "ProjectLighthouse", Version = "v1" }); + }); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { + if(env.IsDevelopment()) { + app.UseDeveloperExceptionPage(); + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ProjectLighthouse v1")); + } + + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => { + endpoints.MapControllers(); + }); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/WeatherForecast.cs b/ProjectLighthouse/WeatherForecast.cs new file mode 100644 index 00000000..f3d38082 --- /dev/null +++ b/ProjectLighthouse/WeatherForecast.cs @@ -0,0 +1,13 @@ +using System; + +namespace ProjectLighthouse { + public class WeatherForecast { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string Summary { get; set; } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/appsettings.Development.json b/ProjectLighthouse/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/ProjectLighthouse/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/ProjectLighthouse/appsettings.json b/ProjectLighthouse/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/ProjectLighthouse/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +}