Homepage Data
Get all data displayed on the homepage.
Interface Information
- Endpoint:
GET /api/home - Authentication: Not required (public interface)
- Content-Type:
application/json
Response Fields
| Field Name | Type | Description |
|---|---|---|
| hero | object | Homepage banner information |
| hero.title | string | Title |
| hero.subtitle | string | Subtitle |
| hero.avatar | string | Avatar URL |
| hero.backgroundImage | string | Background image URL |
| stats | object | Statistical data |
| stats.articles | number | Total articles |
| stats.projects | number | Total projects |
| stats.views | number | Total visits |
| carousels | array | Carousel list |
| latestArticles | array | Latest articles |
| featuredProjects | array | Featured projects |
| skills | array | Skills list |
Request Example
bash
curl http://localhost:3000/api/homeResponse Example
json
{
"success": true,
"data": {
"hero": {
"title": "Welcome to My Blog",
"subtitle": "Sharing technology and life",
"avatar": "https://example.com/avatar.jpg",
"backgroundImage": "https://example.com/hero-bg.jpg"
},
"stats": {
"articles": 150,
"projects": 25,
"views": 12500
},
"carousels": [
{
"id": 1,
"title": "Carousel 1",
"imageUrl": "https://example.com/banner1.jpg",
"linkUrl": "/articles/1"
}
],
"latestArticles": [
{
"id": 1,
"title": "Latest Article",
"excerpt": "Article excerpt",
"coverImage": "https://example.com/article.jpg",
"createdAt": "2024-01-15T10:00:00.000Z"
}
],
"featuredProjects": [
{
"id": 1,
"title": "Project 1",
"description": "Project description",
"coverImage": "https://example.com/project.jpg",
"techStack": ["Vue.js", "TypeScript"]
}
],
"skills": [
{
"name": "Vue.js",
"category": "frontend",
"level": 90
}
]
}
}Error Responses
| HTTP Status Code | Description |
|---|---|
| 500 | Server error |
Caching
This interface is cached by default for 5 minutes to improve performance.