This setup will run your Rails application in a Docker container with a PostgreSQL database, Redis and Sidekiq.
To run the application using Docker, follow these steps:
- Set up environment variables
cp .env.example .env
- Build the Docker containers:
docker compose build
- Start the Docker containers:
docker compose up
- Access the application: Open your browser and navigate to http://localhost:3000.
Note: The application will be seeded with the entities at db/seeds.rb
The app is deployed at Heroku.

βοΈ Note: Emails might be sent to the spam folder.
https://guarded-dusk-82007-3d4643b2b311.herokuapp.com/api/v1
Endpoint: /posts
Method: GET
Description: Retrieves a list of posts with pagination.
Parameters:
page
(optional): Page number for pagination.ids
(optional): Comma-separated list of post IDs to filter.
Example Request:
curl -X GET "https://guarded-dusk-82007-3d4643b2b311.herokuapp.com/api/v1/posts?page=1"
Example Response:
[
{
"id": 2,
"title": "Apple",
"body": "Apple",
"author_id": 24,
"created_at": "2024-10-30T02:31:29.804Z",
"updated_at": "2024-10-30T02:31:29.804Z",
"comments": [
{
"id": 6,
"body": "Commenting on someone else",
"post_id": 2,
"author_id": 23,
"created_at": "2024-10-30T18:37:11.378Z",
"updated_at": "2024-10-30T18:37:11.378Z"
},
{
"id": 7,
"body": "Yes!",
"post_id": 2,
"author_id": 23,
"created_at": "2024-10-30T19:24:28.963Z",
"updated_at": "2024-10-30T19:24:28.963Z"
},
{
"id": 9,
"body": "Email to icloud.",
"post_id": 2,
"author_id": 23,
"created_at": "2024-10-30T19:46:15.411Z",
"updated_at": "2024-10-30T19:46:15.411Z"
}
]
}
]
Endpoint: /posts/:id
Method: GET
Description: Retrieves a specific post by ID.
Parameters:
id
(required): ID of the post.
Example Request:
curl -X GET "https://guarded-dusk-82007-3d4643b2b311.herokuapp.com/api/v1/posts/1"
Example Response:
{
"id": 1,
"title": "Gmail",
"body": "Testing with Gmail.",
"author_id": 23,
"created_at": "2024-10-30T02:29:10.790Z",
"updated_at": "2024-10-31T03:54:25.045Z",
"comments": [
{
"id": 2,
"body": "Amazing! - edited\r\n",
"post_id": 1,
"author_id": 23,
"created_at": "2024-10-30T02:29:33.392Z",
"updated_at": "2024-10-30T02:29:42.549Z"
},
{
"id": 4,
"body": "Beautiful! - edited",
"post_id": 1,
"author_id": 24,
"created_at": "2024-10-30T02:33:20.506Z",
"updated_at": "2024-10-30T02:33:27.330Z"
},
{
"id": 5,
"body": "Commenting on myself",
"post_id": 1,
"author_id": 23,
"created_at": "2024-10-30T18:31:46.875Z",
"updated_at": "2024-10-30T18:31:46.875Z"
},
{
"id": 8,
"body": "Email to myself.",
"post_id": 1,
"author_id": 23,
"created_at": "2024-10-30T19:45:47.462Z",
"updated_at": "2024-10-30T19:45:47.462Z"
}
]
}
Endpoint: /posts
Method: POST
Description: Creates a new post.
Parameters:
title
(required): Title of the post.body
(required): Body of the post.author_id
(required): ID of the author.
Example Request:
curl -X POST "https://guarded-dusk-82007-3d4643b2b311.herokuapp.com/api/v1/posts" -d '{ "post": { "title": "New Post", "body": "This is the body of the new post.", "author_id": 23 } }'
Example Response:
{
"id": 5,
"title": "New Post",
"body": "This is the body of the new post.",
"author_id": 23,
"created_at": "2024-10-31T05:32:42.686Z",
"updated_at": "2024-10-31T05:32:42.686Z"
}
Endpoint: /posts/:id
Method: PUT
Description: Updates an existing post.
Parameters:
id
(required): ID of the post.title
(optional): New title of the post.body
(optional): New body of the post.
Example Request:
curl -X PUT "https://guarded-dusk-82007-3d4643b2b311.herokuapp.com/api/v1/posts/5" -d '{ "post": { "title": "New Post - Edited" } }'
Example Response:
{
"title": "New Post - Edited",
"author_id": 23,
"id": 5,
"body": "This is the body of the new post.",
"created_at": "2024-10-31T05:32:42.686Z",
"updated_at": "2024-10-31T05:35:21.944Z"
}
Endpoint: /posts/:id
Method: DELETE
Description: Deletes a specific post by ID.
Parameters:
id
(required): ID of the post.
Example Request:
curl -X DELETE "https://yourdomain.com/api/v1/posts/5"