Learn how to build fast and secure RESTful APIs with ASP.NET Core.
Overview
Syllabus
Introduction
- The power of RESTful APIs
- What you should know
- Example API introduction
- What is REST?
- REST vs. RPC
- Self-documentation and HATEOAS
- HTTP methods
- Full and partial updates
- Returning JSON
- The Ion hypermedia type
- Create a new project
- Configure MVC
- Create a root controller
- Test with Postman
- Route to controllers with templates
- Introduction to OpenAPI
- Add NSwag to the project
- Approaches to API versioning
- Add versioning support
- Serialize exceptions as JSON
- Transport security in ASP.NET Core
- Require HTTPS
- Test HTTPS locally
- How CORS works
- Add CORS middleware
- Create a resource class
- Load data from configuration
- Return data from a controller
- Set up an in-memory database
- Create data model classes
- Seed the database with test data
- Return a resource from a controller
- Move data access to a service
- Map models automatically
- Create a Link class
- Rewrite Links with a filter
- Rewrite resource HREFs
- Create a Collection class
- Return all resources in a collection
- Add pagination
- Paging defaults and validation
- Add navigation to paged collections
- Design collection sort
- Add sort attributes
- Validate sort parameters
- Build sort expressions dynamically
- Add a default sort term
- Design collection search
- Add search attributes
- Validate search parameters
- Build search expressions dynamically
- Extend search to other types
- Add comparison operators
- Forms in Ion
- Create a POST action
- Delete a resource
- Serialize the form metadata
- Discoverable queries using forms
- Compress responses
- How HTTP caching works
- Add the Cache-Control header
- Support the ETag header
- Add server-side caching
- How HTTP authentication works
- Authentication for REST APIs
- Add Identity
- Add a test user
- Create a users collection
- Create a registration route
- Add OpenIddict
- Add a token endpoint
- Create a UserInfo route
- More about OpenID Connect
- Authorization using policies
- Next steps
Taught by
Nate Barbettini