Building an HTTPS server
So far, the API is served locally through HTTP, but for a real-world application, it should be served under a domain name through HTTPS.
To set this up, proceed as follows:
- Use the
ngrok
solution to serve our local web API with a public Uniform Resource Locator (URL) that supports both HTTP and HTTPS.Note
In advanced chapters, we will explore how to purchase a domain name and set up HTTPS for free on a cloud provider such as Amazon Web Services (AWS).
- Download the ZIP file based on your operating system (OS) from the official Ngrok page at https://ngrok.com/download. In this book, we will work with version 2.3.35. Once downloaded, unzip Ngrok from a terminal with the following commands:
unzip ngrok-stable-darwin-amd64.zip cp ngrok /usr/local/bin/ chmod +x /usr/local/bin/ngrok
- Verify if it's properly installed by executing the following command:
ngrok version
It should output the following message:
- Configure...