Esempio n. 1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            EfAsyncQueryExecutioner.Setup();

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

            app.UseCors();

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Cybtans.Test API V1");
                c.EnableFilter();
                c.EnableDeepLinking();
                c.ShowCommonExtensions();

                c.OAuthClientId("swagger");
                c.OAuthClientSecret(Configuration.GetValue <string>("Identity:Secret"));
                c.OAuthAppName("Cybtans.Test");
                c.OAuthUsePkce();
            });

            app.UseReDoc(c =>
            {
                c.RoutePrefix = "docs";
                c.SpecUrl("/swagger/v1/swagger.json");
                c.DocumentTitle = "Cybtans.Test API";
            });


            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            #region GraphQL

            // add http for Schema at default url /graphql
            app.UseGraphQL <ISchema>();

            // use graphql-playground at default url /ui/playground
            app.UseGraphQLPlayground("/ui/playground");

            #endregion

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Esempio n. 2
0
        public override Task InitializeAsync()
        {
            return(Run(async provider =>
            {
                EfAsyncQueryExecutioner.Setup();

                var context = provider.GetService <AdventureContext>();
                await context.Database.EnsureCreatedAsync();
                await Seed(context);
            }));
        }