using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Umbraco.Web.BackOffice.AspNetCore; using Umbraco.Web.Common.Extensions; using Umbraco.Web.Website.AspNetCore; namespace Umbraco.Web.UI.BackOffice { public class Startup { private readonly IWebHostEnvironment _webHostEnvironment; private readonly IConfiguration _config; /// /// Constructor /// /// /// /// /// Only a few services are possible to be injected here https://github.com/dotnet/aspnetcore/issues/9337 /// public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config) { _webHostEnvironment = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment)); _config = config ?? throw new ArgumentNullException(nameof(config)); } // This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddUmbracoConfiguration(_config); services.AddUmbracoCore(_webHostEnvironment); services.AddUmbracoWebsite(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseUmbracoRequest(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseUmbracoWebsite(); app.UseUmbracoBackOffice(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Hello World!"); }); }); } } }