Menu

ASP.net Resting!
πŸ“°

ASP.net Resting!

DEV Community: dotnetΒ·FaithInErrorsZOROΒ·11 days ago
#3sviZxhH
#devtodotnet#devto#dev#ccc#msg
Reading 0:00
15s threshold

In this post we're cooking up two apps that work together:

FoodMenuApi , a REST API over a small restaurant database of dishes , their cuisines and categories , and which restaurants have them on the menu.

FoodMenuClient , an https://www.google.com/url?q=http://ASP.NET&source=gmail&ust=1793897479914000&sa=E Core MVC website that calls the API with HttpClient , so users can browse, search, add, edit and remove dishes through normal web forms.

Along the way we'll cover EF Core scaffolding, keeping controllers skinny with a repository, DTOs, CORS, proper HTTP status codes (including a 409 Conflict when you try to delete a dish that's still on a restaurant's menu), and a tiny JavaScript page that calls the API directly.

Here's the API we're building:

Method URL What it does

GET /api/dishes All dishes, sorted by name

GET /api/dishes/5 One dish

GET /api/dishes?name=pad Dishes whose name starts with "pad", any case

POST /api/dishes Add a dish (data in the body)

PUT /api/dishes/5 Update a dish (data in the…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.