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.
- 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.
-
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>
-
Add
test.json
to theconfig/db
folder with the test config from.env
.{ "host": "PGHOST_TEST", "port": PGPORT_TEST, "user": "PGUSER_TEST", "password": "PGPASSWORD_TEST", "database": "PGDATABASE_TEST", }
-
Run the commands below to install dependencies and setup the database:
npm install npm run pgm up npm run pgm:test up