Initial Setup:
- Ensure you have postgres installed.
- In postgres:
- setup a user and password (can use the postgres super user)
- Create a database called cen4020
- use "/c cen4020" to connect to the database
- Enter the following command (still in postgres):
CREATE TABLE users
(
username TEXT PRIMARY KEY,
password TEXT,
fname TEXT,
lname TEXT,
DOB DATE,
favoriteTeam TEXT,
favoritePlayer TEXT
);
- Close postgres
- Open terminal
- git clone the repository
- Go to the server folder
- Create a file named db.js
- Copy paste the following code into db.js
const Pool = require("pg").Pool;
const pool = new Pool({
user: "replaceWithYourPostgresUser",
password: "replaceWithYourPostgresPassword",
host: "localhost",
port: 5432,
database: "cen4020
});
module.exports = pool;
- Replace the postgres user/password with your own in the above copy pasted code
- Save db.js then close the file.
- Back in the terminal, still in the server folder, run "npm install"
- Then, run "node index.js", still in the server folder
- Keep this terminal open, open a second terminal
- Go to the client/my-app folder
- Run "npm install"
- Run "npm start"
- The application should open in your web browser.
Running after initial setup:
- Open terminal
- Go to the server folder
- run "node index.js"
- Keep this terminal open, open a second terminal
- Go to the client/my-app folder
- Run "npm start"
- The application should open in your web browser.