aspnetcore/template_feed/Microsoft.DotNet.Web.Projec.../content/WebApi-FSharp/Startup.fs

41 lines
1.4 KiB
Forth

namespace Company.WebApplication1
open System
open System.Collections.Generic
open System.Linq
open System.Threading.Tasks
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Hosting
open Microsoft.Extensions.Configuration
open Microsoft.Extensions.DependencyInjection
open Microsoft.Extensions.Logging
type Startup private () =
new (env: IHostingEnvironment) as this =
Startup() then
let builder =
ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional = false, reloadOnChange = true)
.AddJsonFile((sprintf "appsettings.%s.json" (env.EnvironmentName)), optional = true)
.AddEnvironmentVariables()
this.Configuration <- builder.Build()
// This method gets called by the runtime. Use this method to add services to the container.
member this.ConfigureServices(services: IServiceCollection) =
// Add framework services.
services.AddMvc() |> ignore
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment, loggerFactory: ILoggerFactory) =
loggerFactory.AddConsole(this.Configuration.GetSection("Logging")) |> ignore
loggerFactory.AddDebug() |> ignore
app.UseMvc() |> ignore
member val Configuration : IConfigurationRoot = null with get, set