mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-12-22 23:59:08 +03:00
API-DOCS-FIX
Co-authored-by: Serkan9748 <Serkan9748@users.noreply.github.com>
This commit is contained in:
parent
0e659a8aa4
commit
87cf4f3274
9 changed files with 32 additions and 223 deletions
|
@ -1,9 +1,7 @@
|
|||
# API documentation of Akf-forum
|
||||
<img src="https://raw.githubusercontent.com/Akif9748/akf-forum/main/public/images/logo.jpg" align="right" width="300px" />
|
||||
|
||||
Akf-forum has got an API for other clients etc.
|
||||
|
||||
You can find examples in `tests` folder.
|
||||
Akf-forum has got an API for AJAX, other clients etc.
|
||||
|
||||
## Authorization
|
||||
You need this headers for send request to API:
|
||||
|
@ -13,6 +11,7 @@ You need this headers for send request to API:
|
|||
"password": "testPassword"
|
||||
}
|
||||
```
|
||||
But in front end, the API will works with session.
|
||||
|
||||
## How to request?
|
||||
|
||||
|
@ -35,31 +34,33 @@ You need this headers for send request to API:
|
|||
- POST `/api/messages/:id/react/:type` for react to a message.
|
||||
|
||||
### Example request:
|
||||
```GET /api/messages/1```
|
||||
GET ```/api/messages/0```
|
||||
|
||||
#### Example API Output:
|
||||
```json
|
||||
{
|
||||
"status": 200,
|
||||
"result":
|
||||
{
|
||||
"content": "First message",
|
||||
"time": 1647178873587,
|
||||
```json
|
||||
{
|
||||
"_id": "63067429bc01da866fad508b",
|
||||
"threadID": "0",
|
||||
"author": {
|
||||
"id": "0",
|
||||
"name": "Akif9748",
|
||||
"avatar": "https://cdn.discordapp.com/avatars/539506680140922890/abd74d10aac094fc8a5ad5c86f29fdb9.png?size=1024",
|
||||
"time": "2022-08-24T18:54:55.666Z",
|
||||
"deleted": false,
|
||||
"edited": false,
|
||||
"react": {},
|
||||
"id": "1",
|
||||
"author": {
|
||||
"name": "ForumcuCocuk",
|
||||
"avatar": "/images/guest.png",
|
||||
"time": 1647177723873,
|
||||
"admin": true,
|
||||
"id": "1"
|
||||
},
|
||||
"threadID":"0"
|
||||
}
|
||||
"admin": false,
|
||||
"_id": "630673ffbc01da866fad507b",
|
||||
"__v": 0
|
||||
},
|
||||
"content": "deneme",
|
||||
"deleted": false,
|
||||
"edited": false,
|
||||
"time": "2022-08-24T18:55:37.744Z",
|
||||
"id": "0",
|
||||
"__v": 0,
|
||||
"react": {
|
||||
"0": true
|
||||
},
|
||||
"authorID": "0",
|
||||
"reactCount": 1
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
```
|
10
README.md
10
README.md
|
@ -1,7 +1,7 @@
|
|||
# akf-forum
|
||||
<img src="https://raw.githubusercontent.com/Akif9748/akf-forum/main/public/images/logo.jpg" align="right" width="300px" />
|
||||
|
||||
A forum software written in Node.js.
|
||||
A Node.js based forum software.
|
||||
|
||||
## Installation
|
||||
- Clone or download this repo.
|
||||
|
@ -12,11 +12,7 @@ A forum software written in Node.js.
|
|||
Run `node util/reset` to **reset the database**, and run `node util/admin` for give admin perms to first member.
|
||||
|
||||
## API
|
||||
Akf-forum has got an API for other clients etc. You can test api with python files in `test` folder.
|
||||
|
||||
Python is only for testing 😭
|
||||
|
||||
And, you can learn about API in `util/APIDOCS.md`.
|
||||
Akf-forum has got an API for AJAX, other clients etc. And, you can learn about API in `util/APIDOCS.md`.
|
||||
|
||||
## Credits
|
||||
* [Akif9748](https://github.com/Akif9748) - Project mainteiner, main developer, made **old** frontend
|
||||
|
@ -27,7 +23,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
|||
### Old frontend
|
||||
![akf-forum](https://user-images.githubusercontent.com/70021050/160255959-ef216cba-1348-4d4b-9347-fe67e21348e7.png)
|
||||
### New frontend
|
||||
![image](https://user-images.githubusercontent.com/70021050/186941146-f9a8fbf8-9b2b-4028-afc8-81cff559d9fb.png)
|
||||
![new-akf-forum](https://user-images.githubusercontent.com/70021050/186941146-f9a8fbf8-9b2b-4028-afc8-81cff559d9fb.png)
|
||||
|
||||
|
||||
## Roadmap
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
import requests
|
||||
|
||||
# Headers for login to Akf-forum
|
||||
headers = {
|
||||
"username": "testUser",
|
||||
"password": "testPassword"
|
||||
}
|
||||
|
||||
|
||||
r = requests.get("http://localhost:3000/api/messages/1/", headers=headers)
|
||||
|
||||
print(r.json())
|
||||
|
||||
example_response = {
|
||||
'status': 200,
|
||||
'result': {
|
||||
'content': 'a',
|
||||
'author': {
|
||||
'name': 'Akif9748',
|
||||
'avatar': 'https://www.technopat.net/sosyal/data/avatars/o/298/298223.jpg?1644694020',
|
||||
'time': 1649189944864,
|
||||
'admin': False,
|
||||
'deleted': False,
|
||||
'id': "0"
|
||||
},
|
||||
'time': 1649189950166,
|
||||
'threadID': "0",
|
||||
'deleted': False,
|
||||
'edited': False,
|
||||
# Reactions: {userid: isLike (Bool)}
|
||||
'react': {'0': True},
|
||||
'id': "0"
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
import requests
|
||||
|
||||
# Headers for login to Akf-forum
|
||||
headers = {
|
||||
"username": "testUser",
|
||||
"password": "testPassword"
|
||||
}
|
||||
|
||||
|
||||
r = requests.get("http://localhost:3000/api/threads/0/", headers=headers)
|
||||
|
||||
print(r.json())
|
||||
|
||||
example_response = {
|
||||
"status": 200,
|
||||
"result": {
|
||||
"author": {
|
||||
"name": "Akif9748",
|
||||
"avatar": "https://www.technopat.net/sosyal/data/avatars/o/298/298223.jpg?1644694020",
|
||||
"time": 1647895891332,
|
||||
"admin": False,
|
||||
"deleted": False,
|
||||
"id": "0"
|
||||
},
|
||||
"title": "First Thread",
|
||||
"messages": ["0", "1", "2", "3"],
|
||||
"time": 1647895907054,
|
||||
"deleted": False,
|
||||
"id": "0"
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
import requests
|
||||
|
||||
# Headers for login to Akf-forum
|
||||
headers = {
|
||||
"username": "testUser",
|
||||
"password": "testPassword"
|
||||
}
|
||||
|
||||
|
||||
r = requests.get("http://localhost:3000/api/users/0/", headers=headers)
|
||||
|
||||
print(r.json())
|
||||
|
||||
example_response = {
|
||||
'status': 200,
|
||||
'result': {
|
||||
'name': 'Akif9748',
|
||||
'avatar': 'https://www.technopat.net/sosyal/data/avatars/o/298/298223.jpg?1644694020',
|
||||
'time': 1647895891332,
|
||||
'admin': True,
|
||||
'deleted': False,
|
||||
'id': "0"
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
import requests
|
||||
|
||||
# Headers for login to Akf-forum
|
||||
headers = {
|
||||
"username": "testUser",
|
||||
"password": "testPassword"
|
||||
}
|
||||
|
||||
# Body for message parameters
|
||||
body = {
|
||||
"content": "This message sent via API",
|
||||
"threadID": 0
|
||||
}
|
||||
|
||||
r = requests.post("http://localhost:3000/api/messages/",
|
||||
headers=headers, data=body)
|
||||
|
||||
print(r.json())
|
||||
|
||||
example_response = {
|
||||
'status': 200,
|
||||
'result': {
|
||||
'content': 'This message sent via API',
|
||||
'author': {
|
||||
'name': 'testUser',
|
||||
'avatar': '',
|
||||
'time': 1649009854217,
|
||||
'admin': False,
|
||||
'deleted': False,
|
||||
'id': "2"
|
||||
},
|
||||
'time': 1649010863471,
|
||||
'threadID': "1",
|
||||
'deleted': False,
|
||||
'edited': False,
|
||||
'react': {},
|
||||
'id': "6"
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
import requests
|
||||
|
||||
# Headers for login to Akf-forum
|
||||
headers = {
|
||||
"username": "testUser",
|
||||
"password": "testPassword"
|
||||
}
|
||||
|
||||
r = requests.post("http://localhost:3000/api/messages/0/react/like",
|
||||
headers=headers)
|
||||
|
||||
print(r.json())
|
||||
|
||||
example_response = {
|
||||
'status': 200,
|
||||
'result': 1 # Number of likes
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
import requests
|
||||
|
||||
# Headers for login to Akf-forum
|
||||
headers = {
|
||||
"username": "testUser",
|
||||
"password": "testPassword"
|
||||
}
|
||||
|
||||
# Body for message parameters
|
||||
body = {
|
||||
"content": "This message sent via API",
|
||||
"title": "This thread opened by API"
|
||||
}
|
||||
|
||||
r = requests.post("http://localhost:3000/api/threads/",
|
||||
headers=headers, data=body)
|
||||
|
||||
print(r.json())
|
||||
|
||||
example_response = {
|
||||
'status': 200,
|
||||
'result': {
|
||||
'author': {
|
||||
'name': 'Akif9748',
|
||||
'avatar': 'https://www.technopat.net/sosyal/data/avatars/o/298/298223.jpg?1644694020',
|
||||
'time': 1647895891332, 'admin': True, 'deleted': False, 'id': "0"
|
||||
},
|
||||
'title': 'API TEST',
|
||||
'messages': ["4", "6"],
|
||||
'time': 1649010834064,
|
||||
'deleted': False,
|
||||
'edited': False,
|
||||
'id': "1",
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<%- include("extra/meta", {title: "User list!" }) %>
|
||||
<%- include("extra/meta", {title: "Admin Panel!" }) %>
|
||||
|
||||
|
||||
<body style="text-align: center;">
|
||||
|
@ -11,10 +11,3 @@
|
|||
<h2 style="color: #606060;">Write an ID to give someone admin permissions:</h2>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!--tam olarak neresi, body içi de, sana komik bisey gostercektim kayybolmus.
|
||||
veritabanı sifrem sence neydi fdsajıgdsıgasd nereden bileyim oradan müneccime mi benziyorum
|
||||
neyse tamam sdapgdsjagsadp
|
||||
lşösdlkşsdklsklsdkl buradan da konuşmadık demeyiz
|
||||
evet benziyorsn cogu seyi tahmin ediyorsun. buradan konusalim artik zeynep goruldu yok burada, ney yazdiysan da gdiyior gdsagdsgdsh
|
||||
-->
|
Loading…
Reference in a new issue