

First, we will set up node-postgres, and then we will write a basic query to make a new table and log it to the console.
Basic postgresql tutorial how to#
I'm not trying to write a tutorial on how to make a whole application, so we are just going to tackle a few steps here. Nice job! Your database is up and running. Download the SSL certificate, which we will use to connect.Add your IP address so the database access isn't open to the public.The database will get created and you can see it in your project.You'll need to set up some options here but it's pretty self-explanatory. I used the PostgreSQL, which at the time of writing is the only option.
Basic postgresql tutorial code#
That costs $15 a month, but it's cheaper than a course, it's legit, I saved me a bunch of time (I mean, people have full-time jobs managing databases) and DigitalOcean gives you referral codes that let you get credits for a certain amount of time (usually 30-60 days) and I had credit so it was free to try! If you want to give it a try sign up using my referral code and you can get $50 in credits for 30 days so it's free for you to get started.

I settled on a DigitalOcean managed database. At first, I tried to set up my own server with MySQL installed (which would have been about $5 a month to run) but that was becoming a bit of a beast to figure out, and ultimately my goal was to just be able to access a SQL database to be able to write a frontend application so I didn't want to spend all my time there. In short its a site where you can set up virtual servers among other things. If you haven't used DigitalOcean yet, it's pretty great.

In this post, I am going to be looking at creating a managed PostgreSQL (which from now on I'm just going to call a SQL database) and connecting to it using node_postgres.
