示例#1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
            }

            app.UseDeveloperExceptionPage();
            app.UseHttpsRedirection();
            app.UseRouting();
            app.UseAuthorization();
            app.UseCors(Program.AllowSpecificOrigins);

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

            var option = new RewriteOptions();

            option.AddRedirect("^$", "ui/playground");
            app.UseRewriter(option);

            #region GraphQL Setup
            app.UseGraphQL <AppScheme <MacroQuery> >();
            StartupResolve.Configure(app);
            #endregion
        }
示例#2
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
            }
            else
            {
                app.UseHsts();
            }

            Program.PostalCodeApi = new Uri(Program.Configuration.ReadConfig <string>("Program", "PostalCodeApi"));

            app.UseDeveloperExceptionPage();
            app.UseSwagger();

            #region Assembly Info
            var assembly         = GetType().Assembly;
            var productAttribute = assembly
                                   .GetCustomAttributes(typeof(AssemblyProductAttribute), false)
                                   .OfType <AssemblyProductAttribute>()
                                   .FirstOrDefault();
            var assemblyInfo = assembly.GetName();
            #endregion

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json",
                                  $"{productAttribute.Product} v{assemblyInfo.Version}");
            });
            app.UseRouting();
            app.UseAuthorization();
            app.UseCors(Program.AllowSpecificOrigins);

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

            var option = new RewriteOptions();
            option.AddRedirect("^$", "swagger");
            app.UseRewriter(option);

            #region GraphQL Setup
            app.UseGraphQL <AppScheme <MacroQuery> >();
            StartupResolve.Configure(app);
            #endregion
        }
示例#3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

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

            app.UseGraphQL <AppScheme <SampleQuery> >();
            StartupResolve.Configure(app);
        }