shahargalon / book-store

0 stars 0 forks source link

Postgres Database #14

Open nirgn975 opened 4 years ago

nirgn975 commented 4 years ago

Create a PostgreSQL database as a SASS on GCP (Cloud SQL).

Make sure to insert the username and password and host as an environment variables. After that, query a new endpoint with insomnia: Default_–_create_person

This is a POST request - which we usually use to create something on the internet, in our case we create a "person" and insert it to the database. After that, you can query the same endpoint but with the GET method to get all the people from the database.

FYI There is pretty big list of HTTP methods that we use for different things, but the most common ones are:

nirgn975 commented 4 years ago

You need to use python-dotenv (pipenv install python-dotenv) and add the .env file to .gitignore. Read this: https://12factor.net

First stage: Add the environment variables to kubernetes. You need to create the Cloud SQL, and upload to the cloud and check that everything is working now.

Second stage: Delete them from the environment variables and add them to kubernetes secret.