/// <summary>
        /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            PersonalityTestDbContext dbContext,
            DatabaseSeeder seeder)
        {
            dbContext.Database.EnsureCreated();
            seeder.SeedDatabase();

            DatabaseConfiguration.EnsureEventStoreIsCreated(Configuration);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseCrossOriginResourceSharing();
            app.UseSwagger("Personality Test");

            app.UseHttpsRedirection();
            app.UseMvc();
        }
        /// <summary>
        /// This method gets called by the runtime.
        /// Use this method to configure the HTTP request pipeline.
        /// </summary>
        /// <param name="app">
        /// Provides the mechanisms to configure an application's request pipeline.
        /// </param>
        /// <param name="env">
        /// Provides information about the web hosting environment an application is running in.
        /// </param>
        /// <param name="loggerFactory">
        /// Represents a type used to configure the logging system
        /// and create instances of ILogger from the registered ILoggerProviders.
        /// </param>
        /// <param name="userManager">
        /// Managing user in a persistence store.
        /// </param>
        /// <param name="dbContext">
        /// Application class for the Entity Framework database context used for identity.
        /// </param>
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            UserManager <User> userManager,
            ApplicationDbContext dbContext,
            DatabaseSeeder seeder)
        {
            // ensure data stores
            dbContext.Database.EnsureCreated();
            DatabaseConfiguration.EnsureEventStoreIsCreated(Configuration);

            if (!env.IsEnvironment(Environment.IntegrationTests))
            {
                DatabaseConfiguration.AddDefaultAdminAccountIfNoneExisting(userManager, Configuration).Wait();
                seeder.SeedDatabase().Wait();
            }

            if (!env.IsDevelopment())
            {
                app.UseHsts();
                app.UseHttpsRedirection();
            }

            app.UseCors(builder => builder
                        .SetIsOriginAllowedToAllowWildcardSubdomains()
                        .WithOrigins("http://localhost:3000", "https://jbet.net")
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            loggerFactory.AddLogging(Configuration.GetSection("Logging"));

            app.UseSwagger("Jbet");

            app.UseStaticFiles();
            app.UseAuthentication();

            // soon app.UseSignalR

            app.UseMvc();
        }
Esempio n. 3
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, UserManager <User> userManager, ApplicationDbContext dbContext, DatabaseSeeder seeder)
        {
            dbContext.Database.EnsureCreated();
            DatabaseConfiguration.EnsureEventStoreIsCreated(Configuration);

            if (!env.IsEnvironment(Environment.IntegrationTests))
            {
                DatabaseConfiguration.AddDefaultAdminAccountIfNoneExisting(userManager, Configuration).Wait();
                seeder.SeedDatabase().Wait();
            }

            if (!env.IsDevelopment())
            {
                app.UseHsts();
                app.UseHttpsRedirection();
            }

            app.UseCors(builder => builder
                        .SetIsOriginAllowedToAllowWildcardSubdomains()
                        .WithOrigins("http://localhost:3000", "https://*.devadventures.net")
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            loggerFactory.AddLogging(Configuration.GetSection("Logging"));

            app.UseSwagger("Cafe");
            app.UseStaticFiles();
            app.UseAuthentication();

            // It's very important that UseAuthentication is called before UseSignalR
            app.UseSignalR(routes =>
            {
                routes.MapHub <ConfirmedOrdersHub>("/confirmedOrders");
                routes.MapHub <HiredWaitersHub>("/hiredWaiters");
                routes.MapHub <TableActionsHub>("/tableActions");
            });

            app.UseMvc();
        }
Esempio n. 4
0
        /// <summary>
        /// Configures the HTTP request pipeline.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="env"></param>
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            DatabaseConfiguration.EnsureEventStoreIsCreated(Configuration);

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            app.UseCrossOriginResourceSharing();

            app.UseSwagger("Chat-bot");
        }