示例#1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IWarmUpClient warmUpClient, HeroStreamService heroStream)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();


            warmUpClient.Initialize();
            app.UseAuthentication();

            app.UseCors("Everything");

            app.UseSignalR(routes =>
            {
                routes.MapHub <HeroHub>("hero");
                routes.MapHub <UserNotificationHub>("userNotifications");
            });
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });
        }
示例#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,
            IWarmUpClient warmUpClient,
            ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            warmUpClient.Initialize();

            app.UseCors("TempCorsPolicy");
            app.SetGraphQLMiddleWare();
            //app.UseWebSockets();
            //app.UseGraphQLEndPoint<HeroesAppSchema>("/graphql");

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseGraphiQl();
            }

            app.UseMvc();
        }