things and stuff

This commit is contained in:
2025-01-07 21:56:50 -06:00
parent e2cc55345a
commit 696cc84dc0
9 changed files with 76 additions and 59 deletions
+31
View File
@@ -0,0 +1,31 @@
using Microsoft.OpenApi.Models;
using BarkMan.DB;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "BarkMan API", Description = "BARK BARK WOOF WOOF", Version = "v1" });
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Bark Inventory API V1");
});
}
app.MapGet("/", () => "Hello World!");
app.MapGet("/inventory/{id}", (int id) => InventoryDb.GetInventory(id));
app.MapGet("/inventory", () => InventoryDb.GetInventory());
app.MapPost("/inventory", (InventoryItem item) => InventoryDb.CreateInventoryItem(item));
app.MapPut("/inventory", (InventoryItem item) => InventoryDb.UpdateItem(item));
app.MapDelete("/inventory/{id}", (int id) => InventoryDb.RemoveItem(id));
app.Run();