Welcome to the Blog API documentation.
- Project Description
- Prerequisites
- Running the Project Locally
- API Documentation
- Additional Resources
This API allows you to manage posts and tags for a blog. Below you'll find details on how to set up, use, and interact with the API.
Before you begin, ensure you have met the following requirements:
Follow these steps to run the project on your local development environment:
-
Pull the Image
docker pull eulbyvan/blog_api
-
Run the application:
docker compose up
-
Access the application:
Open your web browser and navigate to
http://localhost:8080
.
-
Get a paginated list of posts filtered by a specific tag
GET /api/posts?tag={TAG_FILTER_STRING}&page={PAGE_NUMBER_INT}&size={PAGE_SIZE_INT}
Response:
200 OK
: Returns a JSON array of posts -
Create a new post
POST /api/posts
Request Body:
{ "title": "REST API with Go", "content": "Lorem ipsum", "tags": ["Go", "Lang"] }
Response:
201
Created: Returns the created post object -
Update a post
PUT /api/posts/{id}
Request Body:
{ "title": "REST API with Go", "content": "Lorem ipsum dolor sit amet", "tags": ["Go", "Lang"] }
Response:
200 OK
: Returns the updated post object -
Delete an existing post
DELETE /api/posts/{id}
Response:
204 No Content
: Indicates that the post was successfully deleted