Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider services)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseStaticFiles();
            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseCors(builder => builder.AllowAnyOrigin()//WithOrigins("http://localhost:1337")
                        .AllowAnyHeader()
                        .AllowAnyMethod());

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
            app.UseSwagger();
            app.UseSwaggerUI(options => {
                options.SwaggerEndpoint("/swagger/v1/swagger.json", "VueBookLibrary API");
            });

            SeedData.SeedDatabase(services.GetRequiredService <DataContext>());
            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
        }
Beispiel #2
0
        public void Configure(IApplicationBuilder app, DataContext context)
        {
            app.UseDeveloperExceptionPage();
            app.UseStaticFiles();
            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints => {
                endpoints.MapControllerRoute("controllers",
                                             "controllers/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
                endpoints.MapBlazorHub();

                endpoints.MapFallbackToClientSideBlazor <BlazorWebAssembly.Startup>
                    ("/webassembly/{*path:nonfile}", "index.html");

                endpoints.MapFallbackToPage("/_Host");
            });

            app.Map("/webassembly", opts =>
                    opts.UseClientSideBlazorFiles <BlazorWebAssembly.Startup>());

            SeedData.SeedDatabase(context);
            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
        }
Beispiel #3
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AppDbContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSession();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapRazorPages();
            });

            SeedData.SeedDatabase(context);
            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
        }
Beispiel #4
0
        // 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();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            //these required in this order for login services
            app.UseAuthentication();
            app.UseAuthorization();


            //endpoints for urls
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute("pagenum",
                                             "ViewRecords/{pageNum}",
                                             new { Controller = "Home", action = "DataDisplay" });

                endpoints.MapControllerRoute("dataPage",
                                             "{controller}/{action}/{pageNum}",
                                             new { Controller = "Home", action = "DataDisplay" });

                endpoints.MapControllerRoute("dataAll",
                                             "{controller}/{action}/{BurialId}",
                                             new { Controller = "Home", action = "DataDisplay" });

                endpoints.MapControllerRoute("filter",
                                             "{controller}/{action}/{burialid}",
                                             new { Controller = "Home", action = "DataDisplay", method = "get" });

                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
            });

            //seeddata to create the groups and a sinlge admin user for the app
            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
        }
Beispiel #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, DataContext context)
        {
            app.UseDeveloperExceptionPage();
            app.UseStaticFiles();
            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints => {
                endpoints.MapControllerRoute("controllers",
                                             "controllers/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
            });
            SeedData.SeedDatabase(context);
            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
        }
Beispiel #6
0
        // 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();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    "pagination",
                    "{pageNum}",
                    new { Controller = "Home", action = "BurialList" });

                endpoints.MapControllerRoute("controllers",
                                             "controllers/{controller=Home}/{action=Index}/{id?}");

                endpoints.MapControllerRoute("controllers",
                                             "Roles/List");

                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");

                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
            });
            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
        }
Beispiel #7
0
        public void Configure(IApplicationBuilder app, DataContext context)
        {
            app.UseDeveloperExceptionPage();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.Map("/webassembly/{*path}", builder => {
                app.Use(async(context, next) => {
                    PathString pathPrefix = new PathString("/webassembly");
                    context.Request.Path.StartsWithSegments(pathPrefix, out var rest);
                    if (rest != string.Empty && rest != "/")
                    {
                        context.Request.Path = rest;
                    }
                    await next();
                });
                app.UseStaticFiles();
            });

            app.UseBlazorFrameworkFiles();

            app.UseEndpoints(endpoints => {
                endpoints.MapControllerRoute("controllers",
                                             "controllers/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToFile("/webassembly/{*path:nonfile}", "index.html");
                endpoints.MapFallbackToPage("/_Host");
            });

            SeedData.SeedDatabase(context);
            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
        }
Beispiel #8
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env, BabyTrackerContext context)
 {
     if (env.IsProduction())
     {
         app.UseExceptionHandler("/Error/Error500");
     }
     else
     {
         app.UseDeveloperExceptionPage();
         app.UseStatusCodePages();
     }
     app.UseStaticFiles();
     app.UseRouting();
     app.UseAuthentication();
     app.UseAuthorization();
     app.UseEndpoints(endpoints =>
     {
         endpoints.MapControllers();
         endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
         endpoints.MapRazorPages();
     });
     IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);
     SeedData.SeedDatabase(context, app.ApplicationServices);
 }
Beispiel #9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseDeveloperExceptionPage();
            app.UseStatusCodePages();
            app.UseStaticFiles();


            app.UseRouting();

            app.UseAuthentication();
            //app.UseAuthorization();
            app.UseAuthorization();
            //app.UseMvcWithDefaultRoute();


            app.UseEndpoints(endpoints =>
            {
                //endpoints.MapControllers();
                //endpoints.MapControllerRoute(
                //    name: "pagination",
                //    pattern: "Cars/Page{carPage}",
                //    defaults: new { Controller = "Car", action = "Index" });

                //endpoints.MapControllerRoute(
                //    name: "default",
                //    pattern: "{controller=Car}/{action=List}/{id?}");// .MapControllers();

                endpoints.MapControllerRoute("default",
                                             "/{controller=Car}/{action=Index}/{id?}");
                //endpoints.MapControllerRoute("controllers",
                //    "controllers/{controller=Home}/{action=Index}/{id?}");
                //endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
                //endpoints.MapFallbackToController("Blazor", "Home");
            });

            IdentitySeedData.CreateAdminAccount(app.ApplicationServices, Configuration);

            //app.UseAuthentication();


            //IdentitySeedData.EnsurePopulated(app);

            //app.UseMvcWithDefaultRoute();
            //app.UseMvc(routes => {
            //    routes.MapRoute(
            //        name: "pagination",
            //        template: "Cars/Page{carPage}",
            //        defaults: new { Controller = "Car", action = "Index" });

            //    routes.MapRoute(
            //        name: "default",
            //        template: "{controller=Car}/{action=Index}/{id?}");
            //});
            //app.UseMvc(routes =>
            //{
            //    routes.MapRoute(
            //        name: "default",
            //        template: "{controller}/{action}",
            //        defaults: new { controller = "Car", action = "Index" });
            //});
            //if (env.IsDevelopment())
            //{
            //    app.UseDeveloperExceptionPage();
            //}

            //app.UseRouting();

            //app.UseEndpoints(endpoints =>
            //{
            //    endpoints.MapGet("/", async context =>
            //    {
            //        await context.Response.WriteAsync("Hello World! From Kernel Cars");
            //    });
            //});
        }