Chapter 6: Adding Authentication and Connecting to the Database
In the previous chapter, we added an HTTP framework to our application, heavily simplifying our code. After that, we added the concept of users to the application and developed the register endpoint. In its current state, our application is already storing a couple of things, with the small gotcha that it's storing it in memory. We'll tackle this specific issue in this chapter.
Another concept that we've used while implementing oak (the HTTP framework of choice) was middleware functions. We'll start this chapter by learning what middleware functions are, and why they are one of the standards in pretty much all Node.js and Deno frameworks when it comes to reusing code.
We'll then use middleware functions and implement login and authorization. Adding to that, we will learn how to use middleware to add standard features such as request logging and timing to the application.
With our application...