Chapter 7: HTTPS, Extracting Configuration, and Deno in the Browser
In the previous chapter, we pretty much wrapped up our application's features. We added authorization and persistence, ending up with an application connected to a MongoDB instance. In this chapter, we'll focus on some known best practices that are standard in production applications: basic security practices and dealing with configuration.
First, we'll add a couple of basic security features to our application programming interface (API), starting with Cross-Origin Resource Sharing (CORS) protection, to enable the filtering of requests based on their origin. Then, we'll learn how to enable HyperText Transfer Protocol Secure (HTTPS) in our application so that it supports encrypted connections. This will allow users to perform requests to the API using a secure connection.
Until now, we've used a few secret values, but we weren't concerned about having them in the code. In this chapter...