Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/keidsid/dicoding-forum-api

Back-End Expert project assignment from dicoding.com
https://github.com/keidsid/dicoding-forum-api

ci-cd dicoding-submission hapi-js jest node-js postgre-sql

Last synced: 2 months ago
JSON representation

Back-End Expert project assignment from dicoding.com

Awesome Lists containing this project

README

        

[class-link]: https://www.dicoding.com/academies/276
[pm-v1]:
https://github.com/dicodingacademy/a276-backend-expert-labs/raw/099-shared-content/shared-content/03-submission-content/01-Forum-API-V1/Forum%20API%20V1%20Test.zip
[pm-v2]:
https://github.com/dicodingacademy/a276-backend-expert-labs/raw/099-shared-content/shared-content/03-submission-content/02-Forum-API-V2/Forum%20API%20V2%20Test.zip

# dicoding-forum-api

[![CI - Test](https://github.com/KeidsID/dicoding-forum-api/actions/workflows/ci-test.yml/badge.svg)](https://github.com/KeidsID/dicoding-forum-api/actions/workflows/ci-test.yml)
[![codecov](https://codecov.io/gh/KeidsID/dicoding-forum-api/branch/main/graph/badge.svg?token=J44SKMPO19)](https://codecov.io/gh/KeidsID/dicoding-forum-api)

Back-End Expert project assignment from [dicoding.com][class-link]. 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

- [x] User Registration.
- [x] Login and Logout.
- [x] Adding Threads.
- [x] Viewing Threads.
- [x] Adding and Deleting Thread Comments.
- [x] Adding and Deleting Replies to Thread Comments.
- [x] Like and Dislike Comment.

## Unit tests from Dicoding

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

- [Forum API V1 Postman Collection + Environment Test][pm-v1].
- [Forum API V2 Postman Collection + Environment Test][pm-v2].

## Project Setup

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

```sh
# Server config
HOST=
PORT=

# PostgreSQL config
PGHOST=
PGPORT=
PGUSER=
PGPASSWORD=
PGDATABASE=

# PostgreSQL config for testing
PGHOST_TEST=
PGPORT_TEST=
PGUSER_TEST=
PGPASSWORD_TEST=
PGDATABASE_TEST=

# JWT config
ACCESS_TOKEN_KEY=
REFRESH_TOKEN_KEY=
ACCESS_TOKEN_AGE=
```

2. Add `test.json` to the `config/db` folder with the test config from `.env`.

```json
{
"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:
```sh
npm install
npm run pgm up
npm run pgm:test up
```