-
Book Overview & Buying
-
Table Of Contents
Accelerating Server-Side Development with Fastify
By :
Since we need to add new non-trivial functionality to our application, we need to implement mainly two pieces:
Before jumping directly into the code, we need to add one last note. In this chapter’s code snippets, we will use a new data source called userDataSource ([1]). Since it exposes only createUser ([3]) and readUser ([2]) methods and the implementation is trivial, we will not show it in this book. However, the complete code is in the ./routes/auth/autohooks.js file inside the GitHub repository.
Since we must implement both, we can add the authentication plugin first.
First, create the ./plugins/auth.js file inside the project’s root folder. The auth.js code snippet shows the implementation...