{"id":21445406,"url":"https://github.com/kathleenwest/minimalwebapipizzastoretutorialdemo","last_synced_at":"2025-03-17T01:18:15.662Z","repository":{"id":214110895,"uuid":"735700079","full_name":"kathleenwest/MinimalWebApiPizzaStoreTutorialDemo","owner":"kathleenwest","description":"Quick steps and demo code to quickly create a minimal web api with asp.net core and swagger setup. This project code is the result of a Microsoft Learn tutorial to build a web API with minimal API, ASP.NET Core, and .NET. ","archived":false,"fork":false,"pushed_at":"2023-12-25T22:58:01.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T11:16:19.411Z","etag":null,"topics":["asp-net-core","crud","demo","how-to","mapget","mappost","microsoft-learn","minimal-api","minimal-web-api","pizza","pizza-app","quick","quick-start","step-by-step","step-by-step-guide","swagger","swagger-ui","tutorial","web-api","webapi"],"latest_commit_sha":null,"homepage":"https://portfolio.katiegirl.net/2023/12/25/minimal-web-api-with-asp-net-core-demo-and-quick-start/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kathleenwest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-25T21:52:35.000Z","updated_at":"2024-03-13T10:53:16.000Z","dependencies_parsed_at":"2023-12-25T23:28:38.925Z","dependency_job_id":"d6791293-8147-41e2-bf1d-e5a93ce8bba6","html_url":"https://github.com/kathleenwest/MinimalWebApiPizzaStoreTutorialDemo","commit_stats":null,"previous_names":["kathleenwest/pizzastoreminimalwebapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathleenwest%2FMinimalWebApiPizzaStoreTutorialDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathleenwest%2FMinimalWebApiPizzaStoreTutorialDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathleenwest%2FMinimalWebApiPizzaStoreTutorialDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kathleenwest%2FMinimalWebApiPizzaStoreTutorialDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kathleenwest","download_url":"https://codeload.github.com/kathleenwest/MinimalWebApiPizzaStoreTutorialDemo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955799,"owners_count":20374373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","crud","demo","how-to","mapget","mappost","microsoft-learn","minimal-api","minimal-web-api","pizza","pizza-app","quick","quick-start","step-by-step","step-by-step-guide","swagger","swagger-ui","tutorial","web-api","webapi"],"created_at":"2024-11-23T02:26:52.824Z","updated_at":"2025-03-17T01:18:15.641Z","avatar_url":"https://github.com/kathleenwest.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PizzaStoreMinimalWebApi\n\nA minimal web api project to showcase basic CRUD operations with Http Verb Operations (Get, Post, Put, and Delete). Swagger documentation is configured for test and verification of the web api. See quick steps and demo code to quickly create a minimal web api with asp.net core and swagger setup. This project code is the result of a Microsoft Learn tutorial to build a web API with minimal API, ASP.NET Core, and .NET.\n\n## How to Quickly Create a Minimal Web Api\n\n### Step #1 - Create web app\n```dotnet new web -o PizzaStore -f net8.0```\n\n### Step #2 - Add Routes to Program.cs\nJust before app.Run(), add your routes to do stuff. Here is a simple example with a pizza route:\n```\napp.MapGet(\"/pizzas/{id}\", (int id) =\u003e PizzaDB.GetPizza(id));\napp.MapGet(\"/pizzas\", () =\u003e PizzaDB.GetPizzas());\napp.MapPost(\"/pizzas\", (Pizza pizza) =\u003e PizzaDB.CreatePizza(pizza));\napp.MapPut(\"/pizzas\", (Pizza pizza) =\u003e PizzaDB.UpdatePizza(pizza));\napp.MapDelete(\"/pizzas/{id}\", (int id) =\u003e PizzaDB.RemovePizza(id));\n```\n### Step #3 - Add Swagger Documentation (Program.cs)\n#### Install the Swashbuckle package\n```dotnet add package Swashbuckle.AspNetCore --version 6.5.0```\n#### Configure Builder Services\n```\nbuilder.Services.AddEndpointsApiExplorer();\nbuilder.Services.AddSwaggerGen(c =\u003e\n{\n    c.SwaggerDoc(\"v1\", new OpenApiInfo { Title = \"PizzaStore API\", Description = \"Making the Pizzas you love\", Version = \"v1\" });\n});\n```\n#### Configure the app\n```\n// Change configurations based on environmental settings\n// HINT: See Project Properties --\u003e Debug --\u003e Launch Profiles --\u003e Select\n// Add ASPNETCORE_ENVIRONMENT = \"Development\"\nif (app.Environment.IsDevelopment())\n{\n    app.UseSwagger();\n    app.UseSwaggerUI(c =\u003e\n    {\n        c.SwaggerEndpoint(\"/swagger/v1/swagger.json\", \"PizzaStore API V1\");\n    });\n}\n```\n## Demo Picture\n![Swagger Demo](/images/swagger.jpg)\n## References\n\nThis code is the result of a Microsoft Learn tutorial project: [Build a web API with minimal API, ASP.NET Core, and .NET](https://learn.microsoft.com/en-us/training/modules/build-web-api-minimal-api/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkathleenwest%2Fminimalwebapipizzastoretutorialdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkathleenwest%2Fminimalwebapipizzastoretutorialdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkathleenwest%2Fminimalwebapipizzastoretutorialdemo/lists"}