/forum-api

Powerful RESTful service with JavaScript, Node.js, and Hapi. Create threads, add comments, like posts, and reply effortlessly. Built with Test-Driven Development for reliability. Streamlined CI/CD with GitHub Actions. Simplify your forum interactions with Forum API

Primary LanguageJavaScript

Forum API

Continuos Integration


Overview

Forum API is a RESTful API built using Javascript and Node.js, leveraging the Hapi framework. It provides features for creating user accounts, managing threads, adding comments, liking comments, and replying to comments. The project utilizes PostgreSQL as a relational database, JWT for authentication, and follows the principles of clean architecture.

Table of Contents

Technologies Used

  • JavaScript : The primary programming language
  • Node.js : The runtime environment for executing JavaScript code.
  • Hapi Framework : A powerful and flexible framework for building web applications.
  • PostgreSQL (Relational Database) : A relational database management system for data storage.
  • JWT (JSON Web Tokens) for User Authentication

Features

  • User Accounts:

    • Create user accounts with secure authentication using JWT.
  • Threads:

    • Create and manage discussion threads.
  • Comments:

    • Add comments to threads.
    • Like comments.
    • Reply to comments.

Installation

  1. Clone the repository:

    git clone https://github.com/muhariananda/forum-api.git
    cd forum-api
  2. Install dependencies

    npm install
  3. Database setup

    • Create a PostgreSQL databases for application and test, then update the configuration in config/database.js.
  4. Environment variables

    • Create a .env file based on the .env.example file and configure the required variables.
  5. Run Migration

    npm run migrate up
  6. Run the application

    npm run start

Usage

  1. Authentication

    • Obtain a JWT token by authenticating with your user credentials.
  2. API Endpoint

    • Refer to the API documentation for detailed information on available endpoints and their usage.

Testing

The project includes both unit tests and integration tests, following Test-driven Development (TDD) practices.

  • Run migration for database test

    npm run migrate:test up
  • Run test

    npm run test
  • Run test coverage and watch

    npm run test:watch

Happy coding! ❤️ 🖥️