Skip to content

thipereira02/api-fullstack-overflow-developer

Repository files navigation

API FullStackOverflow Developer

In API FullStackOverflow Developer people can freely post and answer questions. Each question can have only one answer or none (if it hasn't been answered yet)

Try it out now at https://back-fullstackdeveloper.herokuapp.com/

About

This is a API web app that lets you post and answer questions.

  • Post a new question
  • Register a new user to answer questions
  • Answer questions
  • See answered and unanswered questions

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/API_FullStackOverflow-Developer
  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 fullstack; and hitting enter.
    • 2.5 Type \q and hit enter.
    • 2.6 Finally, type psql fullstack < 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/fullstack"
    • 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 fullstack_test TEMPLATE fullstack; 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/fullstack_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

About

FullStackOverflow Developer is an API for recording questions and answers where people can freely post and answer questions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages