REST API for posts, reactions, uploads, and system stats.
https://s-post-server/api
/post/make
Create a new post. Accepts multipart/form-data.
author (string), content (string), image (file, optional)curl -X POST https://s-post-server/api/post/make \
-F "author=John Doe" \
-F "content=Hello world!" \
-F "image=@photo.jpg"
{
"success": true,
"post": {
"_id": "abc123",
"author": "John Doe",
"content": "Hello world!",
"image": "/api/uploads/photo.jpg",
"likes": 0,
"dislikes": 0,
"createdAt": "2025-08-24T12:00:00Z"
}
}
/post/load
Fetch paginated posts.
loadedPost (array of IDs already loaded), limit (number, default 20){
"loadedPost": ["id1","id2"],
"limit": 20
}
{
"found": true,
"posts": [
{
"_id": "xyz456",
"author": "Jane",
"content": "New update",
"likes": 3,
"dislikes": 0,
"createdAt": "2025-08-24T12:20:00Z"
}
]
}
/post/like
Like or dislike a post.
_id (post ID, required), positive (true/false)POST /api/post/like?_id=xyz456&positive=true
{
"liked": true,
}
/stats
Get total post count and reactions count.
{
"success": true,
"posts": 134,
"reactions": 98
}
/uploads/:filename
Fetch uploaded image or file.
GET /api/uploads/photo.jpg
/api/post/single?_id={postId}&type={type}
types query: api, app
serves single post, in two response , html and api
{
found: true,
post: {
author: "sadiq",
content: "sample post getting",
createdAt: 16297229282729,
likes: 100,
dislikes: 0
}
}
/
Serves the static homepage (home.html).