basic api link for item list
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
using GrossesMitainesAPI.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddCors(options => {
|
||||
options.AddPolicy(name: MyAllowSpecificOrigins,
|
||||
policy => {
|
||||
policy.WithOrigins("http://localhost:3000",
|
||||
"http://localhost:3001");
|
||||
});
|
||||
});
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
builder.Services.AddDbContextFactory<InventoryContext>(options => { options.UseSqlServer("DefaultConnection"); });
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
@@ -22,8 +29,10 @@ if (app.Environment.IsDevelopment()) {
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors(MyAllowSpecificOrigins);
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
app.Run();
|
Reference in New Issue
Block a user