Beispiel #1
0
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              MoviesDbContext moviesDbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
            }
            app.UseStaticFiles();
            moviesDbContext.CreateSeedData();

            app.UseMvc();

            // app.Run(async (context) =>
            // {
            //     await context
            //               .Response
            //               .WriteAsync("Hello World!");
            // });
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, MoviesDbContext moviesDbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

                var options = new WebpackDevMiddlewareOptions()
                {
                    HotModuleReplacement = true
                };
                app.UseWebpackDevMiddleware(options);
            }
            app.UseStaticFiles();
            moviesDbContext.CreateSeedData();
            app.UseMvc();
        }
Beispiel #3
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                       MoviesDbContext moviesDbContext)
 {
     if (env.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }
     app.UseCors();
     app.UseStaticFiles();
     //Create Seeds
     moviesDbContext.CreateSeedData();
     //Implement API routes in MVC
     app.UseMvc((routes) => {
         routes.MapRoute(name: "api", template: "api/{controller}");
         routes.MapRoute(name: "apiaction", template: "api/{controller}/{action}");
         routes.MapRoute(name: "apiactionid", template: "api/{controller}/{action}/{id}");
     });
     //Send index.html file
     app.Run(async(context) => {
         await context.Response.SendFileAsync("wwwroot/index.html");
     });
 }
Beispiel #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, MoviesDbContext moviesDbContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                var options = new WebpackDevMiddlewareOptions()
                {
                    HotModuleReplacement = true
                };
                app.UseWebpackDevMiddleware(options);
            }

            app.UseStaticFiles();

            moviesDbContext.CreateSeedData();

            app.UseMvcWithDefaultRoute();

            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }