Forum Backend API using Node.js and Express. Uses Postgresql database.
- Download the source files.
- Run the
src/database/init.sql
script on your database. - Create a
.env
file based on.env.example
. - Install dependencies by opening a command line and running
npm install
- Run
npm start
HTTP Method | Endpoint | Description |
---|---|---|
POST | /newThread | Submit a new thread |
GET | /thread/:thread_id |
Get thread with id :thread_id |
POST | /thread/:thread_id /vote |
Submit a vote to thread |
POST | /thread/:thread_id /newComment |
Submit a new comment to thread |
GET | /thread/:thread_id /comments |
Get all comments for thread :thread_id |
GET | /comment/:comment_id |
Get comment with id :comment_id |
POST | /thread/:thread_id /:comment_id /newReply |
Submit reply to a comment with id :comment_id |
POST | /thread/:thread_id /:comment_id /vote |
Submit a vote for comment with id :comment_id |
GET | /topic/:topic_id /threads |
Get all threads under topic :topic_id |
HTTP Method | Endpoint | Description |
---|---|---|
POST | /registerUser | Register a new user, returns a JWT |
POST | /login | Attempt to log in, returns a JWT on success |
GET | /user/:displayName |
Get user by Display Name, Includes threads and comments |
GET | /user/:displayName /threads |
Get threads belonging to :displayName |
GET | /user/:displayName /comments |
Get comments belonging to :displayName |