Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ApplicationDbContext>(opts => opts.UseSqlServer(Configuration.GetConnectionString("PamparaDB")));

            // Inject Services
            Injection.AddPamparaServices(services);

            services.AddCors(opts =>
            {
                opts.AddPolicy(name: corsPolicy, b =>
                {
                    b
                    // .AllowAnyOrigin()
                    .WithOrigins(new string[] { "http://localhost:4200", "http://localhost:5001" })
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowCredentials();
                });
            });
            services.AddControllers();
        }