Пример #1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            try
            {
                if (env.IsDevelopment())
                {
                    app.UseDeveloperExceptionPage();
                    app.UseSwagger();
                    app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SMS Microservice v1"));
                }

                app.UseHttpsRedirection();
                app.UseRouting();
                app.UseAuthorization();

                app.UseEndpoints(endpoints =>
                {
                    endpoints.MapControllers();
                });
            }
            catch (Exception ex)
            {
                ProfileLogHelper.LogDesperate(ex);
                throw;
            }
        }
Пример #2
0
        public void ConfigureServices(IServiceCollection services)
        {
            try
            {
                services.AddControllers();
                services.AddLogHelper(Configuration);
                services.AddTransient <IEventBus, EventBusHelper>();
                services.AddTransient <ISmsGateway, SmsGatewayHelper>();

                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v1", new OpenApiInfo {
                        Title = "SMS Microservice", Version = "v1"
                    });
                });
            }
            catch (Exception ex)
            {
                ProfileLogHelper.LogDesperate(ex);
                throw;
            }
        }