diff --git a/api/Controllers/WeatherForecastController.fs b/api/Controllers/WeatherForecastController.fs new file mode 100644 index 0000000..63b6ab5 --- /dev/null +++ b/api/Controllers/WeatherForecastController.fs @@ -0,0 +1,38 @@ +namespace api.Controllers + +open System +open System.Collections.Generic +open System.Linq +open System.Threading.Tasks +open Microsoft.AspNetCore.Mvc +open Microsoft.Extensions.Logging +open api + +[] +[] +type WeatherForecastController (logger : ILogger) = + inherit ControllerBase() + + let summaries = + [| + "Freezing" + "Bracing" + "Chilly" + "Cool" + "Mild" + "Warm" + "Balmy" + "Hot" + "Sweltering" + "Scorching" + |] + + [] + member _.Get() = + let rng = System.Random() + [| + for index in 0..4 -> + { Date = DateTime.Now.AddDays(float index) + TemperatureC = rng.Next(-20,55) + Summary = summaries.[rng.Next(summaries.Length)] } + |] diff --git a/api/Program.fs b/api/Program.fs new file mode 100644 index 0000000..da0e164 --- /dev/null +++ b/api/Program.fs @@ -0,0 +1,36 @@ +namespace api +#nowarn "20" +open System +open System.Collections.Generic +open System.IO +open System.Linq +open System.Threading.Tasks +open Microsoft.AspNetCore +open Microsoft.AspNetCore.Builder +open Microsoft.AspNetCore.Hosting +open Microsoft.AspNetCore.HttpsPolicy +open Microsoft.Extensions.Configuration +open Microsoft.Extensions.DependencyInjection +open Microsoft.Extensions.Hosting +open Microsoft.Extensions.Logging + +module Program = + let exitCode = 0 + + [] + let main args = + + let builder = WebApplication.CreateBuilder(args) + + builder.Services.AddControllers() + + let app = builder.Build() + + app.UseHttpsRedirection() + + app.UseAuthorization() + app.MapControllers() + + app.Run() + + exitCode diff --git a/api/Properties/launchSettings.json b/api/Properties/launchSettings.json new file mode 100644 index 0000000..69f36df --- /dev/null +++ b/api/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:22555", + "sslPort": 44395 + } + }, + "profiles": { + "api": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "weatherforecast", + "applicationUrl": "https://localhost:7115;http://localhost:5217", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/api/WeatherForecast.fs b/api/WeatherForecast.fs new file mode 100644 index 0000000..f3afa40 --- /dev/null +++ b/api/WeatherForecast.fs @@ -0,0 +1,11 @@ +namespace api + +open System + +type WeatherForecast = + { Date: DateTime + TemperatureC: int + Summary: string } + + member this.TemperatureF = + 32.0 + (float this.TemperatureC / 0.5556) diff --git a/api/api.fsproj b/api/api.fsproj new file mode 100644 index 0000000..840dae6 --- /dev/null +++ b/api/api.fsproj @@ -0,0 +1,13 @@ + + + + net6.0 + + + + + + + + + diff --git a/api/appsettings.Development.json b/api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/api/appsettings.json b/api/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/api/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/api/obj/api.fsproj.nuget.dgspec.json b/api/obj/api.fsproj.nuget.dgspec.json new file mode 100644 index 0000000..164f7d5 --- /dev/null +++ b/api/obj/api.fsproj.nuget.dgspec.json @@ -0,0 +1,66 @@ +{ + "format": 1, + "restore": { + "/home/kevin/projects/websites/portfolio/api/api.fsproj": {} + }, + "projects": { + "/home/kevin/projects/websites/portfolio/api/api.fsproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "/home/kevin/projects/websites/portfolio/api/api.fsproj", + "projectName": "api", + "projectPath": "/home/kevin/projects/websites/portfolio/api/api.fsproj", + "packagesPath": "/home/kevin/.nuget/packages/", + "outputPath": "/home/kevin/projects/websites/portfolio/api/obj/", + "projectStyle": "PackageReference", + "configFilePaths": [ + "/home/kevin/.nuget/NuGet/NuGet.Config" + ], + "originalTargetFrameworks": [ + "net6.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "projectReferences": {} + } + } + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "dependencies": { + "FSharp.Core": { + "include": "Runtime, Compile, Build, Native, Analyzers, BuildTransitive", + "target": "Package", + "version": "[6.0.1, )", + "generatePathProperty": true + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.AspNetCore.App": { + "privateAssets": "none" + }, + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/6.0.116/RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/api/obj/api.fsproj.nuget.g.props b/api/obj/api.fsproj.nuget.g.props new file mode 100644 index 0000000..730a921 --- /dev/null +++ b/api/obj/api.fsproj.nuget.g.props @@ -0,0 +1,18 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + /home/kevin/.nuget/packages/ + /home/kevin/.nuget/packages/ + PackageReference + 6.0.4 + + + + + + /home/kevin/.nuget/packages/fsharp.core/6.0.1 + + \ No newline at end of file diff --git a/api/obj/api.fsproj.nuget.g.targets b/api/obj/api.fsproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/api/obj/api.fsproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/api/obj/project.assets.json b/api/obj/project.assets.json new file mode 100644 index 0000000..7c8b0b3 --- /dev/null +++ b/api/obj/project.assets.json @@ -0,0 +1,176 @@ +{ + "version": 3, + "targets": { + "net6.0": { + "FSharp.Core/6.0.1": { + "type": "package", + "compile": { + "lib/netstandard2.1/FSharp.Core.dll": {} + }, + "runtime": { + "lib/netstandard2.1/FSharp.Core.dll": {} + }, + "resource": { + "lib/netstandard2.1/cs/FSharp.Core.resources.dll": { + "locale": "cs" + }, + "lib/netstandard2.1/de/FSharp.Core.resources.dll": { + "locale": "de" + }, + "lib/netstandard2.1/es/FSharp.Core.resources.dll": { + "locale": "es" + }, + "lib/netstandard2.1/fr/FSharp.Core.resources.dll": { + "locale": "fr" + }, + "lib/netstandard2.1/it/FSharp.Core.resources.dll": { + "locale": "it" + }, + "lib/netstandard2.1/ja/FSharp.Core.resources.dll": { + "locale": "ja" + }, + "lib/netstandard2.1/ko/FSharp.Core.resources.dll": { + "locale": "ko" + }, + "lib/netstandard2.1/pl/FSharp.Core.resources.dll": { + "locale": "pl" + }, + "lib/netstandard2.1/pt-BR/FSharp.Core.resources.dll": { + "locale": "pt-BR" + }, + "lib/netstandard2.1/ru/FSharp.Core.resources.dll": { + "locale": "ru" + }, + "lib/netstandard2.1/tr/FSharp.Core.resources.dll": { + "locale": "tr" + }, + "lib/netstandard2.1/zh-Hans/FSharp.Core.resources.dll": { + "locale": "zh-Hans" + }, + "lib/netstandard2.1/zh-Hant/FSharp.Core.resources.dll": { + "locale": "zh-Hant" + } + }, + "contentFiles": { + "contentFiles/any/any/_._": { + "buildAction": "None", + "codeLanguage": "any", + "copyToOutput": false + } + } + } + } + }, + "libraries": { + "FSharp.Core/6.0.1": { + "sha512": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw==", + "type": "package", + "path": "fsharp.core/6.0.1", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "contentFiles/any/netstandard2.0/FSharp.Core.xml", + "contentFiles/any/netstandard2.1/FSharp.Core.xml", + "fsharp.core.6.0.1.nupkg.sha512", + "fsharp.core.nuspec", + "lib/netstandard2.0/FSharp.Core.dll", + "lib/netstandard2.0/FSharp.Core.xml", + "lib/netstandard2.0/cs/FSharp.Core.resources.dll", + "lib/netstandard2.0/de/FSharp.Core.resources.dll", + "lib/netstandard2.0/es/FSharp.Core.resources.dll", + "lib/netstandard2.0/fr/FSharp.Core.resources.dll", + "lib/netstandard2.0/it/FSharp.Core.resources.dll", + "lib/netstandard2.0/ja/FSharp.Core.resources.dll", + "lib/netstandard2.0/ko/FSharp.Core.resources.dll", + "lib/netstandard2.0/pl/FSharp.Core.resources.dll", + "lib/netstandard2.0/pt-BR/FSharp.Core.resources.dll", + "lib/netstandard2.0/ru/FSharp.Core.resources.dll", + "lib/netstandard2.0/tr/FSharp.Core.resources.dll", + "lib/netstandard2.0/zh-Hans/FSharp.Core.resources.dll", + "lib/netstandard2.0/zh-Hant/FSharp.Core.resources.dll", + "lib/netstandard2.1/FSharp.Core.dll", + "lib/netstandard2.1/FSharp.Core.xml", + "lib/netstandard2.1/cs/FSharp.Core.resources.dll", + "lib/netstandard2.1/de/FSharp.Core.resources.dll", + "lib/netstandard2.1/es/FSharp.Core.resources.dll", + "lib/netstandard2.1/fr/FSharp.Core.resources.dll", + "lib/netstandard2.1/it/FSharp.Core.resources.dll", + "lib/netstandard2.1/ja/FSharp.Core.resources.dll", + "lib/netstandard2.1/ko/FSharp.Core.resources.dll", + "lib/netstandard2.1/pl/FSharp.Core.resources.dll", + "lib/netstandard2.1/pt-BR/FSharp.Core.resources.dll", + "lib/netstandard2.1/ru/FSharp.Core.resources.dll", + "lib/netstandard2.1/tr/FSharp.Core.resources.dll", + "lib/netstandard2.1/zh-Hans/FSharp.Core.resources.dll", + "lib/netstandard2.1/zh-Hant/FSharp.Core.resources.dll" + ] + } + }, + "projectFileDependencyGroups": { + "net6.0": [ + "FSharp.Core >= 6.0.1" + ] + }, + "packageFolders": { + "/home/kevin/.nuget/packages/": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "/home/kevin/projects/websites/portfolio/api/api.fsproj", + "projectName": "api", + "projectPath": "/home/kevin/projects/websites/portfolio/api/api.fsproj", + "packagesPath": "/home/kevin/.nuget/packages/", + "outputPath": "/home/kevin/projects/websites/portfolio/api/obj/", + "projectStyle": "PackageReference", + "configFilePaths": [ + "/home/kevin/.nuget/NuGet/NuGet.Config" + ], + "originalTargetFrameworks": [ + "net6.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "projectReferences": {} + } + } + }, + "frameworks": { + "net6.0": { + "targetAlias": "net6.0", + "dependencies": { + "FSharp.Core": { + "include": "Runtime, Compile, Build, Native, Analyzers, BuildTransitive", + "target": "Package", + "version": "[6.0.1, )", + "generatePathProperty": true + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.AspNetCore.App": { + "privateAssets": "none" + }, + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "/usr/lib/dotnet/sdk/6.0.116/RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/api/obj/project.nuget.cache b/api/obj/project.nuget.cache new file mode 100644 index 0000000..c296da7 --- /dev/null +++ b/api/obj/project.nuget.cache @@ -0,0 +1,10 @@ +{ + "version": 2, + "dgSpecHash": "yiQsN9zuNFsQwE5rD1bvmKb2LkPUxTBStlenUjE5prfHVEsOWqez5UPTlQ2uPwnzMX+/02Z8m43BzcokYS9hFg==", + "success": true, + "projectFilePath": "/home/kevin/projects/websites/portfolio/api/api.fsproj", + "expectedPackageFiles": [ + "/home/kevin/.nuget/packages/fsharp.core/6.0.1/fsharp.core.6.0.1.nupkg.sha512" + ], + "logs": [] +} \ No newline at end of file