Closed dopecello closed 1 year ago
What I noticed is that in the server/index.js directory, the getNames query in queries.js is being called via the localhost:3000/names endpoint. I guess that adding a url param is one way to go about it, but the one I know works is sending the state in the request.body. this also makes it easier to test via Postman or Insomnia.
I haven't used Insomnia so I can't speak on that one. Postman can differentiate between query and body params easily though.
Query param added from "params" tab:
Body added from "body" tab:
I typically see query params used for resource scoping like this, and it's the pattern I follow. That said, there's no specific HTTP standard for this so I'm open changing it. I think it's worth all of us understanding the difference between them though so I'll bring it up at the meetup!
I will come to the coffee shop this Tuesday. @murjax, I was wondering if you could edit the README in the server directory. I installed postgres for another project and created a new database called pet_names. I've never used knex before but I tried running the knex migrate:up command and my terminal doesnt recognize the knex command-line tool. Maybe we can walk through it on my machine when we link up?
I installed it globally to get it added to the path: npm install knex -g
Let me know if it doesn't work for any reason. I'll update the README. Good callout!
We also should probably establish some environment vars especially for the postgres password, and use concurrently to consolidate the server activation and seeding process.
Agreed. Production will have different credentials than dev. I'll look into solutions for this (I'm not familiar offhand how to do env var reading in node).
Changed how we're passing the React state variable to the backend.
What I noticed is that in the
server/index.js
directory, thegetNames
query inqueries.js
is being called via thelocalhost:3000/names
endpoint. I guess that adding a url param is one way to go about it, but the one I know works is sending the state in therequest.body
. this also makes it easier to test via Postman or Insomnia.I will come to the coffee shop this Tuesday. @murjax, I was wondering if you could edit the README in the server directory. I installed postgres for another project and created a new database called
pet_names
. I've never used knex before but I tried running theknex migrate:up
command and my terminal doesnt recognize theknex
command-line tool. Maybe we can walk through it on my machine when we link up? We also should probably establish some environment vars especially for the postgres password, and use concurrently to consolidate the server activation and seeding process.We should start a groupchat or something on WhatsApp if that seems like something you all would be interested in?