コード例 #1
0
ファイル: Startup.cs プロジェクト: walterlee7/MoviesAPI
        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!");
            // });
        }
コード例 #2
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.UseMvc();
        }
コード例 #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");
     });
 }
コード例 #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!");
            });
        }