# The COOKIE JAR https://www.youtube.com/watch?v=HrjRj4uQQ1o ![image alt](https://media.giphy.com/media/Jot6EcB3eOpWNlqXgy/giphy.gif) ### A place for cookie lovers to connect and share their love of cookies. --- ## Overview & Demo (V) --- ## Learning (G) * Similar learning objectives * Database * Authentication --- ## Plan and Workflow --- ### Day 1 (L) * Brainstormed on Miro * Reviewed Vatsal's team's codebase from last week * Project board * Mobbed the router as a team * Created the handlers * Realised this project was much bigger than first thought * Touched based regularly throughout the day --- #### Screenshot of Miro workflow (L) ![](https://i.imgur.com/XfcIsPH.png) --- ### Day 2 (cammy) - Hot day! --- That's it --- #### Working with someone else's codebase (cammy) ![](https://media.giphy.com/media/l4FGGafcOHmrlQxG0/giphy.gif) --- # Tech! --- ## Npm run test --silent (L) ```npm run test --silent``` - Removes all the additional error messages you get when you're running a test. Also, npm run test all gives you the full error messages since it's running the full node script - It's better to run npm test - Makes it easier to debug your tests - No errors with `npm test` --- ## Form Validation (G + V) - Password messages & regex --- ## Authentication (G) - quickly implementing cookies auth to certain pages boosted our spirits! ![](https://media.giphy.com/media/24pTKgg4N7LqsNfqR6/giphy.gif) --- ## Cookies (cammy) ```javascript= function newPost(username, message) { console.log(username) return db.query(`SELECT id FROM users WHERE username=($1)`, [username]) .then((item) => { console.log(item.rows); return item.rows[0].id }) .then((id) => { return db.query( "INSERT INTO blog_posts(author_id, post) VALUES($1, $2)", [id, message.post_text] ); }) } ``` --- ## Tests - Errors (L) --- ## Ternary Ops in Templates.js (L) - feel like you're hacking the CIA when you use ternary ```javascript= `${usernameError ? usernameError : ''}` ``` --- ## VS CODE (V) - highlight - M means modified - undo conflicts --- # What else? (V) - Implement delete button in user's page - Remove delete button from all_posts - UX (flow) e.g. Improve navbar - Refactor loads! --- # Q&A --- * 2.30 min - overview, demo, learning objectives * 2 min - planning/workflow (using someone elses project) * 10 min - techy stuff we learned (struggles + wins) - form validation - authentication - cookies - tests + error messages - using ternary op in templates * 1 min - what else we'd do with 'The cookie jar'
{"metaMigratedAt":"2023-06-15T06:26:40.148Z","metaMigratedFrom":"Content","title":"The COOKIE JAR","breaks":true,"contributors":"[{\"id\":\"6898df79-5b31-4c78-acd1-86a97123cdc1\",\"add\":555,\"del\":2},{\"id\":\"11eba2be-5fbb-4639-85ec-7ad40264d41d\",\"add\":793,\"del\":0},{\"id\":\"15813e8a-4a82-4c1f-a14a-8d0c01639173\",\"add\":1133,\"del\":437},{\"id\":\"fc28ac9f-05b4-4c0c-ba0f-978abbf9d995\",\"add\":741,\"del\":138}]"}
    279 views
   Owned this note