You should see a pop up in the middle of your screen with configuration options for your new database server. Right click on servers, click create, click server. When you log in to PG Admin for the first time you'll see a screen like this. Once you have Postgres installed and pgAdmin 4 installed we can move on. If you are unfamiliar with these at all or just want a different take on it, here is a good video tutorial on setting both up. As I said earlier, I use pgAdmin 4 as a GUI and Postgres as the database. Once all those commands have been run you should see that initial repository page turn into this.įollowing the push we can start setting up our database. I essentially followed these steps provided by github, except instead of git add README.md I used git add. Once added you can push by running git push -u origin main I did this by running git remote add origin. Follow this by adding our remote repository locally. git branch -M main changes our primary branch from master to main. to add all of our current files, and git commit -m 'first commit' to commit our changes with a commit message. This is very useful to store secrets like API keys. gitignore file that tells git what we don't want it to save in version control. Now back in the local terminal we are going to turn our project into a local Git repository. Create a new GitHub Repo and it should look a little something like this before you've uploaded your code. Now is a perfect time to make a first Git commit and upload to GitHub. Now if you open your internet browser to you should see this.Īt this point you have confirmation that your code is working and you've configured things correctly so far. If you see this then you've successfully started your server. Run npm run server to start the server with nodemon. Make sure everything is saved, then open a new terminal to the project directory. Now that is all squared away and everyone is up to speed we can actually run the server and access the route from the internet browser to make sure our code is actually working and doing something. When all that is put together it should look like this in your Visual Studio Code. This chunk of code is using our port variable, and telling our server to listen on that port, while its listening on that port the console will display that text to let us know its working. My scripts object looks like this.Įnter fullscreen mode Exit fullscreen mode I will start by installing all the dependencies needed for this tutorial.įirst add start and server scripts to the package.json so we will be able to run the application. This is where we will track the metadata of our application and can add npm scripts to shorten our command line syntax later. Then we can run npm init -y to create a new package.json file as well. env and a file called index.js to the root of the project. Right off the bat I will add a file called. Once we have our VS Code window open we can open a new terminal to the project directory. to open it in Visual Studio Code.Īll of those commands looked a little something like this. Next I can cd production-db-tutorial to move to my newly created project folder and run code. Once here I run mkdir production-db-tutorial to create the new project directory. To do this I open a new terminal.Īnd run cd ~/Desktop/side-projects to change directories. In it I created a new folder called production-db-tutorial. For me, I use Linux and I have a side-projects folder on my desktop. Once we have all of this installed and configured we can get started on the project!įirst we have to create a new project. Side note: For those still a little unsure, here is a very quick video explaining the difference between Git and GitHub.Īnd for those who need a longer introduction to git and GitHub here's this. Those are the main tools we will need and the appropriate installation links for each. Npm commands to install dependencies into our project. This is javascript runtime to run javascript code You can use your text editor of choice, mine is VSCode This is going to allow us to push our git code to Heroku,Īnd there are other useful functions for dealing with Heroku CLI is the command line interface for Heroku. GUI it provides to manage the database and write SQL I use it in my workflow because I like the PgAdmin is technically not necessary for any part of Postgres is the database system we will be using for Github is a code hosting platform that hosts a Remote With a convenient command line interface to saveĭifferent versions of our code and commit them to github This is for my own future reference, and to solidify my skills, as well as to guide others who want a step by step introduction to setting up a production database on Heroku. I want to be certain of my steps and set it up from scratch while documenting the steps I take. I realized I can only stumble my way through setting up a database and deploying to Heroku.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |