For this exercise, we will abstract SQL queries into model files to declutter our controller files - effectively moving completely into an MVC (model view controller) framework.
We will also be introducing a Users table so users can create accounts on the app. Users willnow be able to create pokemon that they own.
- Fork and clone this repository to your computer
- Run
yarn install
to install dependencies - Create a new Postgres database by running
createdb pokemons -U <your_username>
- Run
psql -U <your_username> -d pokemons -a -f tables.sql
- this will create 2 new tables for you - apokemons
table andusers
table in the database - Look in the starter file called
index.js
, runnodemon
to start local server on port 3000 - Open
localhost:3000
on your browser and see the home page
- Add in missing logic implementation in
controllers/pokemon.js
forupdateForm
andupdate
- Add in missing logic implementation in
controllers/user.js
forlogin
- Add a "Logout" button on home page that sends POST request to
/users/logout
to log out a user (hint: remember to remove cookies) - Ensure that you can create a new user account
- Ensure that you can create a new pokemon that belongs to a user
- Update the
user/user.handlebars
file to show all pokemons that a specified user owns (eg./users/1
should show the 1st user's account information and names of pokemons that she owns)
- Singular vs plural naming is important. For this exercise, let's assume that the plural of pokemon is pokemons...
- We have changed our table names to be plural. So user is now users table, and pokemon is now pokemons table.