public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy(name: "MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod(); }); }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "Bills", Version = "v1" }); }); services.AddControllers().AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore ); services.AddDbContext <DataContext>(opt => opt.UseSqlServer(Configuration.GetConnectionString("AirlinesTicketsConnection"))); services.AddControllers(); services.AddScoped <IUserService, UserService>(); services.AddScoped <IUserRepository, UserRepository>(); JWTService.Authentication(services, Settings.Secret); }