Heroku - 10 Heroku postgre part 3
Hello everyone and welcome to the next part of the heroku postgre tutorial, now that we have all the installed and set up I will now create a table with pg admin to initialize postgre just type genius and launch it type genius and launch it I realize when it starts is the reason why we tease us pga the insee because we can not directly make changes in the database heroku which you need an external tool I will now connect to the server postgre is a right click and you will have information about the server that will appear I will simply wound so I'll make an exception then this information here you have to retrieve them on the page of the deal I'll cut if the losc the postillon tunisia don't pay attention database as he min sik it takes the same game you it is the password that should be all you need to connect to the database postgre so we have on the data connections there as you can see several databases of course did not have permission to access those permission to access those that are not yours to find yours you are first needed to know his name fifteen years ago by of the 4 we know it is in the menu until in the sensors and here I found my data base it is the only one that does not have the small cross on the icon and I want here to create a table therefore to cover this file makes click must create and determined I will simply call to table visit its purpose will be to record in the table each visit on application in the columns I will add an idea that will be a hit incremented at each new record in the database this is what we need to insert it will be our primary key had also added a creation date credited on its theme stop said we will prove that we have the visits here created by maintaining a project note that it will create the visits feed my command unit I will give much npm minutes we leave much version it is crowded what they do by fiddling m to j s raises now I want to install of dependences the first one is posed that for that I will type npm install pg that will register all that is in connection with postgre the second dependence and express it will help us to blood the server every time the server roswell investigates inspired me to visit in the table break leaves for that I will type immense talent the express there remains only one thing to make for cole to be ready to deploy this is the project our module and the folder with the dependencies express and would put this all dependencies have so here of a package point g only link the information about about the server here where we will have to learn heroku how it can launch the application for sister it is here made start and then no 2 it will thus one launched the file ap by using of the inde all is thus ready to be deployed I will now create a file that I will call a.gr where I will put the code for the visits and here we open and I'll just paste the code you can just copy the code you see I'm not going to create it in front of you because the code part is not what we are interested in here for this example here we create the server with express this part and to create the connection to the postgre database and finally this part of the code and what will fill the table what we have to do now is send this code to be executed for heroku to do this we first go to heroku diploma we have already installed the heroku celi so the first thing to do is to login cmd have typed heroku login press any key login 1 no it's good we are far from the young and need to do this part because I have no code running we can pass his last three commands a word we will have to do the command says int there is for the moment no folder guide in this folder now we can type git had there it has finished I can mark that they committe draw m forst klute and I can now pocket the code heroku masters as the code was inserted the one created the licorice and to install all the dependences the code now deployed. That's it for postgre that's it for this video, but I say see you soon for the next one!