Week 5 project
We have created the SRVVRS app to provide you with tech tools to aid in your survival during self-isolation. The user can view and add to the list of tools on the remote database.
- Clone this repo
- Run
$ npm install
on your terminal - Run
npm run dev
to check server runs - Run these commands in your terminal to set up user, app database and test database
$ psql -c "CREATE USER myuser WITH PASSWORD 'mypassword'"
$ psql -c "ALTER USER myuser WITH SUPERUSER"
$ psql -c "CREATE DATABASE srvvrs_db WITH OWNER myuser"
$ psql -c "CREATE DATABASE srvvrs_test WITH OWNER myuser"
- Create a
.env
file in the root folder with the following inside
PGDATABASE=srvvrs_db
PGUSER=myuser
PGPASSWORD=mypassword
- Comment out the following line on your
connection.js
file which connects to the Heroku database
// connectionString: process.env.DATABASE_URL,
- Run
psql
to enter Postgres CLI - Connect to database
# \c srvvrs_db
- Initialise database
# \i source/database/init.sql
- Run
$ npm run dev
to run app on localhost - Run
psql
and connect to test database# \c srvvrs_test
- Run
$ npm test
to run tests
CREATE TABLE user_input (
id SERIAL PRIMARY KEY,
category TEXT NOT NULL,
tool_name VARCHAR(50),
tool_description VARCHAR(280),
tool_link VARCHAR(75),
added_by VARCHAR(50)
love INTEGER
);