Description
Book SynopsisIf you are a developer who wants to learn the basic skills of web and application programming interfaces (APIs) with .NET, this book is your complete introduction. The book takes a learn-by-experience approach. You will hit the ground running with a sample project that has everything you need to be wired up. As you follow along, you will learn simple and intuitive conventions that will free you from some of the more tedious decisions and work, in order to allow you to focus on the business requirements required by your team. Certain components of the framework should always appear in certain folders in the solution to speed up development while others need a name that follows particular conventions. You will learn the building blocks of Web API and how to leverage them to have a well-rounded API. Understanding these small but important tricks will make development faster, easier, and more pleasant, and will prevent time-consuming errors. Part I introduces you to the basics of Web.
Table of ContentsPart 1 - API basics
- Web API
1.1. What is web api
1.2. When to use Web API
1.3. The world of web applications
1.4. Summary
- Introduction to Web
2.1. HTTP Protocol
2.2. Request
2.3. Response
2.4. Headers
2.5. HTTP Verbs
2.6. Summary
- Setting up the environment
3.1. Installing Visual Studio
3.2. Installing PostMan
3.3. Your first Web Api Project
3.4. Issuing your first request
3.5. Summary
- Web Api - Building blocks
4.1. Convention over Configuration
4.2. Controllers & Actions
4.3. Models vs DTO
4.4. Routing
4.5. Model Binding
4.6. Middlewares
4.7. Dependency Injection
4.8. Summary
Part 2 - Implementing an API
- Getting started
5.1. Your first RESTful API
5.2. What is REST
5.3. Implementing Get
5.4. Implementing POST
5.5. Implementing HEAD
5.6. Implementing PUT
5.7. Implementing DELETE
5.8. Summary
- Introducing an ORM
6.1. Introducing Entity Framework
6.2. Connecting to a database
6.3. Adding migrations
6.4. Summary
- Getting organized
7.1. Splitting code into layers
7.2. Data Layer, implementing a repository
7.3. Domain Layer
7.3.1. Extending a domain object
7.4. Services Layer
7.5. Introducing AutoMapper
7.6. Wire everything in the controller
7.7. Summary
- Routing
8.1. What is a route
8.2. How to customize routing
8.3. Attribute routing
8.4. Adding two different controllers under the same route
8.5. Route constraints
8.6. Summary
- Middlewares
9.1. Introducing custom middlewares
9.2. Middleware usage scenarios
9.3. Create your own middleware to add some headers
9.4. Summary
Part 3 - Advanced API Topics
- Model Binding
10.1. Create your own Model Binder
10.2. Register your ModelBinder
10.3. Value Providers
10.4. When to use a value provider
10.5. Model Validation
10.6. Summary
- Versioning The API
11.1. Ways of versioning
11.2. Versioning in URL path
11.3. Versioning in QueryString
11.4. Versioning in Headers
11.5. General rules about versioning
11.6. Deprecating Endpoints
11.7. Summary
- Documenting The API
12.1. Introducing Open API
12.2. Working with Swashbuckle
- Testing The API
13.1. What is a test
13.2. Writing unit tests
13.3. Writing integrations test
13.4. Summary