CS 268: Lecture 18 – Today Service
We look at the mechanics of web services last time. Today we build up a non-toy web service for a time capsule application. Behind our web service will be a MySQL database, and our service will endpoints for the four common CRUD operations for operating on our database’s records: creating, rreading, updating, and deleting.
Here’s your TODO list:
- Install MySQL on your droplet according to these instructions from Digital Ocean. Disable remote logins if prompted. We won’t need remote access to our database.
- Watch this video, in which we set up our app’s MySQL database.
- Watch this video, in which we set up an Express-based web service that connects to our database.
- Watch this video, in which we add endpoints to our web service to interface with the four common database operations.
- Install Nginx with
sudo apt install nginx.
- Watch this video, in which we add a process manager and embed our service inside Nginx. To get your SSL certificate for your service follow the next steps.
- Add a new domain name for your service using DuckDNS or some other domain name provider. In the video, I used
- Get a new certificate from Let’s Encrypt for your new domain name with this command:
sudo certbot certonly --dry-run --apache -d NEW-DOMAIN. Replace
NEW-DOMAINwith your new domain name. Once that reports success, run the command again without
--dry-run. We include
--dry-runinitially because Let’s Encrypt blocks you if you make too many failing requests in an hour. We include
--apachebecause our Nginx server is not set up to serve out the files that Let’s Encrypt expects to verify that you own the server.
- You are encouraged to post a reply in the lecture 18 thread with one of the following:
- A question regarding web services or databases. This might be a question you really don’t know the answer to or one that you do know the answer to and are putting forward as a challenge to your peers.
- An answer to a previously posted question or challenge.
See you next time.