3. Demo of the case study app
The case-study project for this course is called PrintBay, and it's an online store for buying prints of famous art works.
Now PrintBay is not a massive app, but it has been specially designed to capture many of the feaures and development challenges that you'll face when building enterprise Vue apps.
So let's now take a look at its main feature and structure.
Beginning with the home page, we can see the prints that are available for sale.
If we click on any particular print, we'll see a detail page, including this "add to cart" button.
If we click that, we'll be redirected to a login page where we can either login or register a new users. So let's go ahead and register a new user.
I'll create one with my name Anthony, and the user name [email protected], and a password.
Once I submit that form, that then redirects us to back to the homepage. Notice in the toolbar at the top right that it's displaying the name I registered and also giving me a logout link.
Let's now click on a print again, and click add to cart again. Since we're authenticated now, that item will be added to the cart, and we can see in the right of the toolbar that there's now a number badge on the cart icon.
Let's click that cart icon in the toolbar and we'll be linked to the cart page. We can edit the quantity of any print in our cart here, or we can remove it from the cart entirely.
Let's now logout using this link in the toolbar, and then we'll sign in again.
This time I'm going to sign in with the email [email protected], and the password is t.e.s.t.18.104.22.168.
This is an account that's provided by default in the database seed, and is the only account with admin privileges.
The main difference between regular user privileges and admin privileges is that on the item page the call to action button is now "edit item" instead of "add to cart".
You'll also notice there's no shopping cart icon in the toolbar for an admin user, and if we attempt to go to the "/cart" route as an admin user we face a HTTP 400 Forbidden page.
Going to the edit page for a print, we change any of it's details. So let's change the price from 29.95 to 39.95.
Now, if we go to the home page again, we can see that price change has taken effect.
In the footer of the page you can also see a links section. Admin users will have a link here "sell new item" which opens a form allowing us to add a new print.
Let's give it a title "My painting", the artist is me, Anthony Gore.
We can now provide a year, but let's actually skip that field and you'll see that validation is triggered and we see an error message.
This also prevents us from submitting the form.
So now you've seen the app we'll be building, let's now do a quick tour of the code base as well.
You may be able to tell that this is a Vue CLI 3 project. You'll see the familiar vue.config file in the root directory for example.
What's a bit different though it that the frontend files are in this folder here, client. If you open that you'll see all the files you normally would see in the src folder in a standard Vue CLI 3 installation.
We also have a server folder here which contains the Express API which has been structured in the classic MVC configuration.
There's also the tests folder here which contains two subdirectories; unit and e2e. Inside the unit folder you'll see our client and server tests and the e2e folder contains the specs for our automated browser testing.
So that's the end of our brief tour of the app and the code. If you'd like to try a live demo of the app, I've put a link below this video.
In the next video we'll get an overview of each module of the course.