From the course: Building and Securing Restful APIs in .NET
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
HATEOAS and the API root - .NET Tutorial
From the course: Building and Securing Restful APIs in .NET
HATEOAS and the API root
- [Instructor] Remember that one of our constraints for tenants for REST is hypertext as the engine of application state, and that is all about providing links and discoverability in our API. So I'm going to go to my controllers, I'm going to add a new file, I'm going to call it HomeController. You may remember that when we've brought up the homepage for our site, or our API, we've gotten a 404, because we don't have a landing page, or a landing API endpoint. So we'll do our namespace here, Controllers. So, we're going to have a HomeController that we're going to use for that. ControllerBase. And we want to put a route on here that allows it to be discoverable, so we're going to just use an empty route here that lets this be at the root. So there is no route, there is no additional path, it's just going to default to this controller when we go to the root. So, in that class, we really only need a couple of things. Well, one, like we did on our others, we need to mark it as an…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.