Skip to content

KeidsID/dicoding-forum-api

Repository files navigation

dicoding-forum-api

CI - Test codecov

Back-End Expert project assignment from dicoding.com. With this assignment, students are expected to be able to create a back-end application in the form of a RESTful API that is testable, scalable, reliable, agile, easy and fast to deploy, and has reliable security by industry standards.

Features

  • User Registration.
  • Login and Logout.
  • Adding Threads.
  • Viewing Threads.
  • Adding and Deleting Thread Comments.
  • Adding and Deleting Replies to Thread Comments.
  • Like and Dislike Comment.

Unit tests from Dicoding

NOTE: Deprecated since v1.2.2, use internal tests instead.

Project Setup

  1. Add .env to the project root with the configuration below:

    # Server config
    HOST=<your server host>
    PORT=<desired port for nodejs>
    
    # PostgreSQL config
    PGHOST=<psql server host>
    PGPORT=<psql server port>
    PGUSER=<psql user>
    PGPASSWORD=<psql password>
    PGDATABASE=<desired database>
    
    # PostgreSQL config for testing
    PGHOST_TEST=<psql server host>
    PGPORT_TEST=<psql server port>
    PGUSER_TEST=<psql user>
    PGPASSWORD_TEST=<psql password>
    PGDATABASE_TEST=<desired database>
    
    # JWT config
    ACCESS_TOKEN_KEY=<random string>
    REFRESH_TOKEN_KEY=<random string>
    ACCESS_TOKEN_AGE=<duration in ms>
  2. Add test.json to the config/db folder with the test config from .env.

    {
      "host": "PGHOST_TEST",
      "port": "PGPORT_TEST",
      "user": "PGUSER_TEST",
      "password": "PGPASSWORD_TEST",
      "database": "PGDATABASE_TEST"
    }
  3. Run the commands below to install dependencies and setup the database:

    npm install
    npm run pgm up
    npm run pgm:test up

About

Back-End Expert project assignment from dicoding.com

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •