Week 6
We have plagiarised the SRV|VRS app to allow you to add and delete tech tools to aid in your survival during self-isolation. Anyone can view these, but only you can add to and delete from the list of tools on the remote database (when you're signed in).
Visit the deployed version of the website on Heroku.
Or set up your own local production 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
);