Ejemplo n.º 1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); });
            }
            app.UseCors(builder => builder
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowAnyOrigin()
                        .AllowCredentials());
            app.UseMvc();
            if (env.IsDevelopment())
            {
                app.UseSwagger();
            }

            app.UseDolittle();

            app.UseDefaultFiles();
            app.UseStaticFiles();

            BoundedContextListener.Start(app.ApplicationServices);
            TextMessageListener.Start(app.ApplicationServices);

            ConfigureCustom(app, env);

            // Keep last
            app.RunAsSinglePageApplication();
        }
Ejemplo n.º 2
0
        public static IApplicationBuilder UseCommon(this IApplicationBuilder app, IHostingEnvironment env)
        {
            Internals.ServiceProvider = app.ApplicationServices;

            app.UsedoLittle(env);

            // Relaxed CORS policy for example only
            app.UseCors(builder => builder
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowAnyOrigin()
                        .AllowCredentials());
            app.UseMvc();
            app.UseSwagger();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); });
            }

            app.UseDefaultFiles();
            app.UseStaticFiles();

            BoundedContextListener.Start(app.ApplicationServices);
            TextMessageListener.Start(app.ApplicationServices);

            return(app);
        }