135 lines
3.1 KiB
Markdown
135 lines
3.1 KiB
Markdown
# Forum Backend
|
|
|
|
Backend for the forum project. This project is under development and is not ready for production.
|
|
|
|
[](https://opensource.org/licenses/MIT)
|
|
|
|
## Table of Contents
|
|
|
|
- [About](#about)
|
|
- [Features](#features)
|
|
- [Installation](#installation)
|
|
- [Routes](#routes)
|
|
- [License](#license)
|
|
- [Creators](#creators)
|
|
- [Contact](#contact)
|
|
|
|
## About
|
|
|
|
This is the backend for a forum you can self host. It is written in NodeJS and uses the Surrealdb database. It is a REST API that uses JSON for communication. It is uses the Express framework. Further it uses the following packages:
|
|
|
|
- auth-guardian: "^1.1.1",
|
|
- cookie-parser: "^1.4.6",
|
|
- cors": "2.8.5",
|
|
- dotenv: "^16.3.1",
|
|
- express: "^4.18.2",
|
|
- jsonwebtoken: "^9.0.2",
|
|
- surrealdb.node: "^0.3.0"
|
|
|
|
The frontend will be written in NextJS and will be a seperate repository.
|
|
This project is under development and is not ready for production.
|
|
|
|
## Features
|
|
|
|
- [x] User authentication
|
|
- [x] User registration
|
|
- [x] User login
|
|
- [x] User logout
|
|
- [x] User profile
|
|
- [x] User profile update
|
|
- [x] User profile delete
|
|
- [x] Create post
|
|
- [x] Like post
|
|
- [x] Comment on post
|
|
- [x] Save post
|
|
- [x] Comment on comment
|
|
- [x] Like comment
|
|
- [x] Save comment
|
|
- [x] Search posts
|
|
- [x] Search users
|
|
- [x] Trending posts
|
|
- [x] Most active users
|
|
- [x] Most liked posts
|
|
- [x] Most commented posts
|
|
- [x] Most saved posts
|
|
|
|
## Installation
|
|
|
|
### Prerequisites
|
|
NodeJS and NPM are required to run this project. You can download them [here](https://nodejs.org/en/download/).
|
|
|
|
### Clone
|
|
|
|
Clone this repository to your local machine using
|
|
|
|
```shell
|
|
git clone https://gitea.quiztimes.nl/kajvans/forum-backend.git
|
|
```
|
|
|
|
### Setup
|
|
|
|
Edit .env.example and rename it to .env. Fill in the required information.
|
|
|
|
### Install dependencies
|
|
|
|
Install the required dependencies using
|
|
|
|
```shell
|
|
npm install
|
|
```
|
|
|
|
### Running
|
|
|
|
Run the project using
|
|
|
|
```shell
|
|
npm start
|
|
```
|
|
|
|
## Routes
|
|
|
|
| Method | Path |
|
|
|--------|------|
|
|
| GET | /logout |
|
|
| GET | /register/password |
|
|
| POST | /register/ |
|
|
| POST | /login/ |
|
|
| GET | /user/:username |
|
|
| PUT | /user/description |
|
|
| PUT | /user/password |
|
|
| PUT | /user/username |
|
|
| PUT | /user/visibility |
|
|
| GET | /user/description/:username |
|
|
| GET | /user/visibility |
|
|
| GET | /user/activity/:type |
|
|
| DELETE | /user/delete |
|
|
| POST | /create/ |
|
|
| DELETE | /create/:id |
|
|
| GET | /post/:id |
|
|
| POST | /post/like/:postId |
|
|
| POST | /post/comment/:postId |
|
|
| POST | /post/comment/:postId/:commentId |
|
|
| POST | /post/like/:postId/:commentId |
|
|
| POST | /post/save/:postId |
|
|
| POST | /post/save/:postId/:commentId |
|
|
| POST | /search/:search |
|
|
| GET | /home/ |
|
|
| GET | /home/trending |
|
|
| GET | /home/mostLiked |
|
|
| GET | /home/mostCommented |
|
|
| GET | /home/mostSaved |
|
|
|
|
## License
|
|
|
|
This project is licensed under the [MIT License](LICENSE) - see the [LICENSE](LICENSE) file for details.
|
|
|
|
## Creators
|
|
|
|
- kaj van schalkwijk
|
|
- ruben jimmink
|
|
|
|
## Contact
|
|
|
|
- GitHub: [Kajvans](https://github.com/kajvans) (for GitHub)
|
|
- Gitea: [Kajvans](https://gitea.quiztimes.nl/kajvans) (for Gitea)
|