.NET 5 REST API Tutorial - Build From Scratch With C#

.NET 5 REST API Tutorial - Build From Scratch With C#

freeCodeCamp.org via freeCodeCamp Direct link

Injecting the repository into the controller

17 of 104

17 of 104

Injecting the repository into the controller

Class Central Classrooms beta

YouTube videos curated by Class Central.

Classroom Contents

.NET 5 REST API Tutorial - Build From Scratch With C#

Automatically move to the next video in the Classroom when playback concludes

  1. 1 Introduction
  2. 2 Creating the project
  3. 3 Exploring the generated project files
  4. 4 Trusting the self-signed certificate
  5. 5 Exploring the default Swagger UI page
  6. 6 Configuring Visual Studio Code settings
  7. 7 Introduction
  8. 8 Adding an entity
  9. 9 Ading an in-memory repository
  10. 10 Creating the controller
  11. 11 Implemeting GET all items
  12. 12 Implemeting GET single item
  13. 13 Returning a 404 NotFound status code
  14. 14 Introduction
  15. 15 What is dependency injection?
  16. 16 Extracting the repository interface
  17. 17 Injecting the repository into the controller
  18. 18 Registering the repository as a singleton
  19. 19 Adding a Data Transfer Object DTO
  20. 20 Creating the AsDto extension method
  21. 21 Introduction
  22. 22 Implementing POST
  23. 23 Adding validations via data annotations
  24. 24 Implemeting PUT
  25. 25 Implementing DELETE
  26. 26 Introduction
  27. 27 Using Postman
  28. 28 Creating a MongoDB repository
  29. 29 Using the MongoDB.Driver NuGet package
  30. 30 Implementing MongoDB Create
  31. 31 Running the MongoDB Docker container
  32. 32 Configuring MongoDB connection settings
  33. 33 Registering the MongoClient singleton
  34. 34 Testing the MongoDB integration
  35. 35 Exploring the created database in VS Code
  36. 36 Implemeting MongoDB Get, Update and Delete
  37. 37 Introduction
  38. 38 Using the Async suffix
  39. 39 Using tasks in the repository
  40. 40 Using async and await
  41. 41 Returning completed tasks
  42. 42 Using tasks in the controller
  43. 43 Testing async methods in Postman
  44. 44 Introduction
  45. 45 Enabling authentication in MongoDB
  46. 46 Using the .NET Secret Manager
  47. 47 Using the MongoDB credentials in the service
  48. 48 Introduction to Health Checks
  49. 49 Adding an endpoint for health checks
  50. 50 Adding a MongoDB health check
  51. 51 Adding checks for readiness and liveness
  52. 52 Customizing the health check response
  53. 53 Exploring other health check NuGet packages
  54. 54 Introduction
  55. 55 What is Docker?
  56. 56 Removing https redirection
  57. 57 Generating a Dockerfile in VS Code
  58. 58 Building the Docker image
  59. 59 Adding a Docker network
  60. 60 Running the containers in the Docker network
  61. 61 Running the REST API in Docker
  62. 62 Pushing the container image to Docker Hub
  63. 63 Exploring the image in Docker Hub
  64. 64 Pulling the image back to the local box
  65. 65 Introduction
  66. 66 What is Kubernetes?
  67. 67 Enabling a Kubernetes cluster in Docker Desktop
  68. 68 Installing the Kubernetes extension for VS Code
  69. 69 Declaring the REST API Kuberentes deployment
  70. 70 Creating a secret in Kubernetes
  71. 71 Declaring health probes
  72. 72 Declaring the REST API Kubernetes service
  73. 73 Creating the REST API resources in Kubernetes
  74. 74 Declaring the MongoDB Kubernetes StatefulSet
  75. 75 Declaring the MongoDB Kubernetes service
  76. 76 Creating the MongoDB resources in Kubernetes
  77. 77 Testing the REST API hosted in Kubernetes
  78. 78 Exploring the Kubernetes self-healing capability
  79. 79 Scaling Kubernetes pods
  80. 80 Adding logs via ILogger
  81. 81 Getting a new image version into Kubernetes
  82. 82 Load balancing requests across pods
  83. 83 Introduction
  84. 84 What is unit testing?
  85. 85 What is test driven development?
  86. 86 Restructuring files and directories
  87. 87 Creating the xUnit test project
  88. 88 Building multiple projects in VS Code
  89. 89 Adding NuGet packages for unit testing
  90. 90 Testing GetItemAsync unexisting item
  91. 91 Using the AAA pattern
  92. 92 Stubbing dependencies via Moq
  93. 93 Running tests in VS Code
  94. 94 Using the .NET Core Test Explorer extension
  95. 95 Testing GetItemAsync existing item
  96. 96 Using FluentAssertions
  97. 97 Testing GetItemsAsync
  98. 98 Testing CreateItemAsync
  99. 99 Testing UpdateItemAsync
  100. 100 Testing DeleteItemAsync
  101. 101 Refactoring and catching regressions
  102. 102 Using TDD to test a yet to be created method
  103. 103 Going back to green by fixing the failing test
  104. 104 Testing the new controller method in Postman

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.