Building your first Provider

To understand how Providers work in practice, we will go through the exercise of building a simple Provider of our own and adding it to our application. The Provider that we build will be a HealthcheckProvider that provides a health check route for our application and returns a success 200 status code with a JSON response, indicating that the server is running and is healthy.

To get started on building the Provider, we will create a new Swift package, publish it, and then import it into our Shopping List Vapor application. So, let's start building out first Provider by following these steps:

  1. Create a folder, call it HealthcheckProvider, and open the folder in the Terminal.
  2. Once you are in the HealthcheckProvider ...

Get Hands-On Full-Stack Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.