Skip to content

Commit cbbf876

Browse files
update README
1 parent 2434cbe commit cbbf876

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.

API.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# API Documentation
2+
## User Management
3+
```POST /api/signup```
4+
5+
Register a new user account.
6+
7+
- Request Body:
8+
9+
username: Username string
10+
password: Password string
11+
other user info fields
12+
- Response:
13+
14+
201: User created successfully
15+
409: Username already exists
16+
17+
```POST /api/login```
18+
19+
Login with username and password.
20+
21+
- Request Body:
22+
23+
username: Username string
24+
password: Password string
25+
- Response:
26+
27+
200: Login succeeded
28+
401: Invalid credentials
29+
Chat
30+
31+
```POST /api/chat```
32+
33+
Send a chat message.
34+
35+
- Request Body:
36+
37+
content: Chat message content
38+
userId: Sender user ID
39+
roomId: Chat room ID
40+
- Response:
41+
42+
200: Message sent
43+
404: User or chat room not found
44+
Friend Management
45+
POST /api/nfmgr
46+
Manage friend requests.
47+
48+
- Request Body:
49+
50+
action: add to send request, accept to accept request
51+
userId: Recipient user ID
52+
- Response:
53+
54+
200: Request success
55+
404: User not found
56+
GET /api/newfriends
57+
Get list of pending friend requests.
58+
59+
- Response:
60+
200: Array of friend request objects
61+
401: Unauthorized
62+
User Info
63+
GET /api/info
64+
Get user profile information.
65+
66+
- Request Header:
67+
68+
Authorization: JWT token
69+
- Response:
70+
71+
200: User info object
72+
401: Invalid token
73+
File Management
74+
POST /api/file/save
75+
Save a file.
76+
77+
- Request Body:
78+
79+
file: File data
80+
path: File path
81+
filename: Filename
82+
- Response:
83+
84+
201: File saved
85+
500: Error saving file
86+
GET /api/file/get
87+
Get a file.
88+
89+
- Request Parameter:
90+
91+
filePath: Path of file on server
92+
Response:
93+
94+
200: File data
95+
404: File not found

0 commit comments

Comments
 (0)