Summary
In this chapter, we built user data model structs and tied them to the to-do item data models in our migrations. We then got to dive a little deeper into our migrations by firing multiple steps in the SQL file to ensure our migration runs smoothly. We also explored how to add unique constraints to certain fields.
Once our data models were defined in the database, we hashed some passwords before storing them in our database with the stored user. We then created a JWT struct to enable our users to store their JWT in their browsers, so that they could submit them when making an API call. We then explored how to redirect the URL in JavaScript and the HTML storage so that the frontend could work out if the user even has credentials, before it entertains the notion of sending API calls to the items.
What we have done here is alter the database with a migration so that our app can manage data models that handle more complexity. We then utilized frontend storage to enable our...