Ejemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            ServiceProviderHelper.Init(app.ApplicationServices);

            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Chat Server Api v1");
                c.RoutePrefix = string.Empty;
            });

            app.UseCors(ConfigureCors);
            app.UseMvc();

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                Formatting            = Formatting.Indented,
                DefaultValueHandling  = DefaultValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                ContractResolver      = new CamelCasePropertyNamesContractResolver()
            };


            DbInitializer.DbInitializer.Seed(app.ApplicationServices);
        }
Ejemplo n.º 2
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            ServiceProviderHelper.Init(app.ApplicationServices);
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseAuthentication();
            app.UseSwagger();
            app.UseSwaggerUI(SwaggerUIConfig);
            app.UseCors("AllowAll");
            app.UseMvc();
            DbInitializer.DbInitializer.Seed(app.ApplicationServices);
        }
Ejemplo n.º 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)
        {
            ServiceProviderHelper.Init(app.ApplicationServices);
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseCors(ConfigureCors);
            app.UseAuthentication();
            app.UseMvc();
            app.UseStaticFiles();

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Demo.API v1");
            });
        }
Ejemplo n.º 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)
        {
            ServiceProviderHelper.Init(app.ApplicationServices);
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            //TODO: enable this to publish to azure
            //app.UseHttpsRedirection();

            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseSignalR((configure) =>
            {
                var desiredTransports = HttpTransportType.WebSockets | HttpTransportType.LongPolling;

                configure.MapHub <ChatHub>("/chatHub", (options) => { options.Transports = desiredTransports; });
            });

            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
            // specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Chat Server Api v1");
                c.RoutePrefix = string.Empty;
            });


            app.UseMvc();
            DbInitializer.Seed(app.ApplicationServices);
        }