mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +00:00
things and stuff
This commit is contained in:
@@ -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();
|
||||
Reference in New Issue
Block a user