/Repoprovas_Back

Repoprovas is a platform where people can share their college exams anonymously.

Primary LanguageTypeScript

Repoprovas

In Repoprovas people can share the tests they have anonymously.

Try it out now at

About

This is an web application where it is possible to view old tests separated by professor or subject and also send tests. Below are the implemented features:

  • Send a test
  • See the test by subjects
  • See the tests by teachers

By using this app any user can improve their studies through targeted practice.

Technologies

The following tools and frameworks were used in the construction of the project:

NodeJS  Express  TypeScript  Jest  PostgresSQL  Heroku 

How to run

  1. Clone this repository
git clone https://github.com/thipereira02/Repoprovas_Back.git
  1. Create a Database using the dump.sql file inside the dump folder by following these steps:
    • 2.1 Open your terminal. Important: the terminal must be opened in the same path as the dump.sql file is located.
    • 2.2 Access PostgreSQL using the command sudo su postgres and enter your password when prompted.
    • 2.3 Next, type psql postgres and hit enter.
    • 2.4 Create a database by typing CREATE DATABASE repoprovas; and hitting enter.
    • 2.5 Type \q and hit enter.
    • 2.6 Finally, type psql repoprovas < dump.sql and hit enter. Your database should be ready after this step.
  2. Set the environment variables by following these steps:
    • 3.1 Create a .env file in the folder root
    • 3.2 Copy the content of the .env.example into it
    • 3.3 Set the DATABASE_URL in this format: "postgres://user:password@host:port/repoprovas"
    • 3.4 Set the PORT for 4000
  3. In your terminal, go back to the root folder and install the dependencies
npm i
  1. Also in the root folder, run the back-end with
npm start
  1. Your server should be running now.

  2. After that, you can optionally test the project following these steps:

    • 7.1 Open your terminal.
    • 7.2 Access PostgreSQL using the command sudo su postgres and enter your password when prompted.
    • 7.3 Next, type psql postgres and hit enter.
    • 7.4 Create a test database by typing CREATE DATABASE repoprovas_test TEMPLATE repoprovas; and hitting enter. Your database test should be ready after this step.
    • 7.5 Set the enviroment variable following the step 5 again, with the following changes:
      • 7.5.1 The file must be called .env.test
      • 7.5.2 The DATABASE_URL must be in this format: "postgres://user:password@host:port/repoprovas_test"
    • Important: the tests assume that some tables are pre-populated. Therefore, it is important to use the dump provided to create the test database.
  3. In your terminal, go to the root folder and run the tests with:

npm run test