http://localhost:3000/api
Use JWT token in the header:
x-auth-token: <your-jwt-token>
Register a new user account.
Request Body:
{
"username": "johndoe",
"email": "john@example.com",
"password": "securepassword123"
}Response:
{
"message": "User registered successfully"
}Login to your account.
Request Body:
{
"email": "john@example.com",
"password": "securepassword123"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}Get current authenticated user info.
Headers:
x-auth-token: <jwt-token>
Response:
{
"_id": "...",
"username": "johndoe",
"email": "john@example.com",
"role": "user",
"createdAt": "2021-06-25T10:30:00.000Z"
}Fetch all problems.
Fetch problem details by ID.
Create a new problem (requires auth).
Headers:
x-auth-token: <jwt-token>
Submit solution code (requires auth).
Get submission details by ID (requires auth).
Get current user's submissions (requires auth).
- GET /contests: Get a list of all contests.
- GET /contests/:id: Get details for a specific contest.
- GET /contests/:id/standings: Get the live standings for a contest.
- POST /contests: Create a new contest. (Admin only)
- POST /contests/:id/register: Register the authenticated user for a contest. (Requires auth)
- POST /contests/:id/submit: Submit a solution to a problem within a contest. (Requires auth)
- POST /contests/:id/publish: Make a contest visible to users. (Admin only)
- GET /categories: Get all categories
- GET /categories/:slug: Get category by slug
- POST /categories: Create a new category (admin only)
- GET /topics: Get topics list (supports pagination, filters)
- GET /topics/search: Search topics
- GET /topics/:slug: Get topic by slug
- POST /topics: Create new topic (requires auth)
- GET /posts/topic/:topicId: Get posts by topic
- POST /posts: Create a post (requires auth)
- POST /posts/:id/like: Like/unlike a post
- DELETE /posts/:id: Delete a post (author/admin/mod only)
- GET /profiles/leaderboard: Get leaderboard
- GET /profiles/:userId: Get profile by user ID
- PUT /profiles/me: Update current user's profile (requires auth)
- GET /stats: Get forum statistics
{
"message": "Validation error message"
}{
"message": "No token, authorization denied"
}{
"success": false,
"message": "Permission denied. Admin access required."
}{
"message": "Resource not found"
}{
"success": false,
"message": "Too many requests from this IP, please try again later."
}{
"message": "Server error"
}- Create Topic: 5 requests per 15 minutes
- Create Post: 10 requests per minute
- Like Post: 30 requests per minute
- All dates follow ISO 8601 format
- Default pagination: page=1, limit=20
- JWT tokens expire in 1 hour
- Forum supports Vietnamese slug generation
- Email notifications are sent for forum activities
- Full-text search supported on titles and content