-
Notifications
You must be signed in to change notification settings - Fork 59
Windows Setup
After finishing this doc you will have VSCode, Node.js, Git, Nodemon and Posgres installed on your machine.
- Vist VSCode to download VSCode.
- Launch the installer and follow the onscreen prompts.
- When you reach the section for
Additional tasks, make sure every box is checked. - Click install and continue to follow and onscreen prompts.
Once you are done, you can open up a terminaland type code to open VSCode. This may or may not require a restart first.
- Visit Node.js and download and run the Windows installer. No need to check "Automatically install the necessary modules".
- You can check your current Node.js version with by running
node -vin your command line
-
Visit Git to download and install Git. This will include the Git Bash CLI, which is our preferred terminalfor Windows.
-
Follow the onscreen instructions.
- Choose the default values for each prompt...
-
EXCEPT when it asks you to
Choose the default editor used by Git...- Click the drop down and choose the VSCode option
- Do NOT choose the "VSCode Insiders" option.
-
Continue choosing the default options to finish the installation.
-
You can check your current version of Git with by running
git --versionin your command line
The final step here is to add your email and name to the Git config. This will allow you to commit and push things to GitHub. Make sure to include the space after .email and .name, and always remember to close your quotes ' ' and " ".
- Close and reopen your command line and run the following:
- Type
git config --global user.email 'Your email here in single quotes'. - Type
git config --global user.name 'Your Name In Single Quotes'. - Type
git config --global core.editor 'code --wait'.
Verify that everything is set correctly by running git config --global --list
Nodemon is a tool that is used to restart the server when changes are made in your server code.
To install, run npm i -g nodemon in your CLI. Run the command nodemon -v to confirm proper installation of Nodemon.
- Go to PostgreSQL's [Windows installers]https://www.postgresql.org/download/windows/, and click on "Download the installer". You will be redirected to EDB to download the installer.
- Download the 11.9 version for Windows.
- During the setup, for Select Components, uncheck Stack Builder
- Complete all other steps as directed
- Make note of the password for the postgres user that is being created during the process
Verify psql is available in the command line by running psql -V.
If you get an error saying that the command is not recognized, then you'll need to add a pointer to the PostgreSQL bin to your PATH variable. To do so, follow the steps below:
- Search for "Environment Variables" in the Windows Search bar
- Click on the "Edit the system environment variables" suggestion
- This will open System Properties > Advanced; click on the Environment Variables... in the bottom right corner
- Under System Variables (the bottom half), find the Path variable; click Edit...
- Add
C:\Program Files\PostgreSQL\11\binas a new environment variable - Restart your terminal.
The update is successful if running
psql -Vreturnspsql (PostgreSQL) 11.9
Verifying Installation And Setting A Password
-
You should be able to run the command
psql -U postgres. You will be asked for a password - this is the password you created during the Postgres installation. This will log you into thepsqlCLI as the userpostgres. -
You should now have a prompt that looks like
postgres=#. You can run SQL commands from here, which must end in semicolons. -
If you were not prompted for a default user or password, we will set one using psql. If you type
\du, you can get a list of users associated with PostgreSQL. You should see a single user,postgres. You will need to set up a new role for your machine's default user. This is the username that appears at the beginning of your CLI, and when you log into your machine. -
In your SQL shell, type the following:
CREATE ROLE your-username-here WITH LOGIN PASSWORD 'your-password-here';, replacing "your-password-here" with whatever you want it to be. Remember that your password must be wrapped in quotes. The username should not be wrapped in quotes. Don't forget the semicolon. -
If successful, you will receive the feedback
CREATE ROLE. -
Now we need to grant that user administrative control. In your SQL shell, type the following:
ALTER ROLE your-username-here WITH superuser;, replacing "your-username-here" with the username you created a role for in the previous step. -
If successful, you will receive the feedback
ALTER ROLE. -
Next, we need to create a default database for your new user and assign ownership of it to your new account. In the SQL shell, type the following:
CREATE DATABASE scproject;. Must bescproject. On success, you will receive the feedbackCREATE DATABASE.- Note: You might get a
WARNING: could not flush dirty data: Function not implementedwarning many times when you run this command. This is okay! Let the command keep running, and you should eventually see success.
- Note: You might get a
-
To change the owner of your database from the
postgresuser to your user, type the folliwing:ALTER DATABASE scproject OWNER TO your-username-here;, replacing "your-username-here" with your username. On success, you will receive the feedbackALTER DATABASE. -
Close your SQL shell with
\qorctrl-D. Typepsqlagain and your SQL shell should now open as your default user. Hooray!
Running the PostgreSQL Server
To start, stop or restart the PostgreSQL server with the following commands:
Note that the path to your PostgreSQL installation may vary
- Start:
pg_ctl -D "C:\Program Files\PostgreSQL\11\data" start - Stop:
pg_ctl -D "C:\Program Files\PostgreSQL\11\data" stop - Restart
pg_ctl -D "C:\Program Files\PostgreSQL\11\data" restart