diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*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/Controllers/HanyadikHetVanController.cs b/Controllers/HanyadikHetVanController.cs new file mode 100644 index 0000000..0c943c0 --- /dev/null +++ b/Controllers/HanyadikHetVanController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace hanyadikhetvan.Controllers +{ + [ApiController] + [Route("[controller]")] + public class HanyadikHetVanController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public HanyadikHetVanController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public HanyadikHetVan Get() + { + return new HanyadikHetVan(); + } + } +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f6d67d9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build +WORKDIR /src +COPY ["hanyadikhetvan.csproj", ""] +RUN dotnet restore "./hanyadikhetvan.csproj" +COPY . . +WORKDIR "/src/." +RUN dotnet build "hanyadikhetvan.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "hanyadikhetvan.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "hanyadikhetvan.dll"] \ No newline at end of file diff --git a/HanyadikHetVan.cs b/HanyadikHetVan.cs new file mode 100644 index 0000000..af4568e --- /dev/null +++ b/HanyadikHetVan.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace hanyadikhetvan +{ + public class HanyadikHetVan + { + public int HanyadikHet { get { return DateTime.Now.Subtract(DateTime.Parse(Environment.GetEnvironmentVariable("HANYADIKHET_STARTDATE"))).Days / 7; } } + } +} diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..c78acb7 --- /dev/null +++ b/Program.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace hanyadikhetvan +{ + 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(); + }); + } +} diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..e893084 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:56869", + "sslPort": 44324 + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "hanyadikhetvan": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": "true", + "applicationUrl": "https://localhost:5001;http://localhost:5000" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true, + "useSSL": true + } + } +} \ No newline at end of file diff --git a/Startup.cs b/Startup.cs new file mode 100644 index 0000000..fd32b2c --- /dev/null +++ b/Startup.cs @@ -0,0 +1,49 @@ +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; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace hanyadikhetvan +{ + 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(); + } + + // 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.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/appsettings.Development.json b/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..d9d9a9b --- /dev/null +++ b/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/hanyadikhetvan.csproj b/hanyadikhetvan.csproj new file mode 100644 index 0000000..3660601 --- /dev/null +++ b/hanyadikhetvan.csproj @@ -0,0 +1,15 @@ + + + + net5.0 + 7ab06640-d35e-42ff-8297-ea0e08f93c36 + Linux + . + + + + + + + + diff --git a/hanyadikhetvan.sln b/hanyadikhetvan.sln new file mode 100644 index 0000000..108e7d6 --- /dev/null +++ b/hanyadikhetvan.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hanyadikhetvan", "hanyadikhetvan.csproj", "{DF27AAF1-02DA-4C0E-82E2-12C019762CC4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DF27AAF1-02DA-4C0E-82E2-12C019762CC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF27AAF1-02DA-4C0E-82E2-12C019762CC4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF27AAF1-02DA-4C0E-82E2-12C019762CC4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF27AAF1-02DA-4C0E-82E2-12C019762CC4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0F759AC2-BB1B-4350-81B8-23FE2E96EE25} + EndGlobalSection +EndGlobal