<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Api.ApplicationServices;
using Api.ApplicationServices.Interfaces;
using Api.Data;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Cors.Internal;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.Swagger;

namespace Api
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {       
            Console.WriteLine($"Conexao mongo {Configuration.GetConnectionString("MongoConnection")}");

            services.AddCors(opt => opt.AddPolicy("CorsPolicy",
            builder => 
                builder.AllowAnyOrigin()
                .AllowAnyHeader()
                .AllowAnyMethod()));

            services.AddMvc();
            services.Configure<MvcOptions>(opt => 
            opt.Filters.Add(new CorsAuthorizationFilterFactory("CorsPolicy")));

            services.AddTransient<IProductApplicationService, ProductApplicationService>();
            services.AddSingleton<IProductContext>(new ProductContext(Configuration.GetConnectionString("MongoConnection")));      

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
            });                  
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseCors("CorsPolicy");

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

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
            });

            app.UseMvc();            
        }
    }
}<commit_msg>Ajustado nome da API<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Api.ApplicationServices;
using Api.ApplicationServices.Interfaces;
using Api.Data;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Cors.Internal;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.Swagger;

namespace Api
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {       
            Console.WriteLine($"Conexao mongo {Configuration.GetConnectionString("MongoConnection")}");

            services.AddCors(opt => opt.AddPolicy("CorsPolicy",
            builder => 
                builder.AllowAnyOrigin()
                .AllowAnyHeader()
                .AllowAnyMethod()));

            services.AddMvc();
            services.Configure<MvcOptions>(opt => 
            opt.Filters.Add(new CorsAuthorizationFilterFactory("CorsPolicy")));

            services.AddTransient<IProductApplicationService, ProductApplicationService>();
            services.AddSingleton<IProductContext>(new ProductContext(Configuration.GetConnectionString("MongoConnection")));      

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info { Title = "Price Store Api", Version = "v1" });
            });                  
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseCors("CorsPolicy");

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

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Price Store Api V0.1");
            });

            app.UseMvc();            
        }
    }
}
{'fraction_non_alphanumeric': 0.09296121485737739, 'fraction_numerical': 0.001846911553457829, 'mean_word_length': 2.3179033356024505, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1014780', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1202, 'n_words': 255}