Ever wanted to remind yourself of something, out of the blue? Well, we're building a quick tool to do that!
* also, delete the lib/formdata.js file
We're going to be using PostgreSQL in our app.
⬅️ ⬅️ ⬅️ Slonik
Get a PSQL database (Heroku, local, etc) + plug it in here:
We want to use the db throughout our app's routes, so let's make sure it gets initialised and passed into the server!
We are mostly going to use this "db" object in routes, so it needs to be able to access them!
No ORM models, let's just write some SQL:
We should write a runnable script to do this for ourselves:
An executable file with no extension is fine, as long as the first line contains a "hashbang" telling your shell how to execute it. We want Node.js to run it, so here's the Node hashbang:
Forms are also a bit of a rabbit hole:
Note we're using parameterised queries to avoid SQL injection:
Before our brains melt!
See you next time where we look at The frontend and serving assets in a pipeline.
Please don't hesitate to contact me or leave feedback on the course:
See today's code: https://github.com/frameworkless-js/remind.ist/tree/stage/4
See today's lesson running live: https://part4.remind.ist