Skip to content

fac-12/FAC-OVERFLOW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FAC-OVERFLOW

https://facoverflow.herokuapp.com/

Our goal this week was to make a forum which only authenticated users could access. They can log in or sign up on the home page.

Posts and comments cannot be edited at this time, they draw from the pre-populated database.

Users can log out.

If user tries to go to the forum page without authentication then they are redirected to the log in page.

Setting up the database locally

Let's start by setting up the database we will connect to.

  1. Connect to postgres, by typing psql in the terminal on MAC, and sudo -u postgres psql on ubuntu.
  2. Create the database by typing CREATE DATABASE [the name of the database];.
  3. Create a superuser with a password by typing CREATE USER [the new username] WITH SUPERUSER PASSWORD '[the password of the database]'; (the password needs to be in quotes, otherwise you get an error).
  4. Change ownership of the database to the new user by typing ALTER DATABASE [name of the database] OWNER TO [the new username];
  5. Add a config.env file and add the database's url in this format: DB_URL = postgres://[username]:[password]@localhost:5432/[database]. The database name needs to be in lower case.