CSCI 3342 Web Development
Spring 2024

Database and SQL

Website + Database

That operator is *overloaded*.
In this step you will upgrade your Server-Side Shopping site from the last assignment to use SQLite instead of a variable as the data store. Start by copying your files (not node_modules!) from the prior repo into this one. If you didn't finish up that last assignment, do that now in the new repo.
Following the video below, make sure that you can connect to your database and execute database queries from within a test route.

SQL Queries From Express Routes (5:48)

Retrieving and modifying database data for our pages.
Replace all uses of the "database" variable from the past assignment with SQL queries. Pass the results of those queries into res.render instead. Update your EJS templates as necessary. Once done, you can delete the "database" variable and your website should function without it. Unlike before, if you stop and restart your server, the reviews that were added should persist in the database.

Assignment Checklist

Copy over your shopping app to the new assignment repo
Update the items route to SELECT the items data from the database
Update the items_view route to SELECT the specified item data and its review data from the database
Update your POST route to SQL INSERT the new review
Confirm that your new reviews persist through server restart