Skip to content

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 NameTypeDescription
heroobjectHomepage banner information
hero.titlestringTitle
hero.subtitlestringSubtitle
hero.avatarstringAvatar URL
hero.backgroundImagestringBackground image URL
statsobjectStatistical data
stats.articlesnumberTotal articles
stats.projectsnumberTotal projects
stats.viewsnumberTotal visits
carouselsarrayCarousel list
latestArticlesarrayLatest articles
featuredProjectsarrayFeatured projects
skillsarraySkills list

Request Example

bash
curl http://localhost:3000/api/home

Response 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 CodeDescription
500Server error

Caching

This interface is cached by default for 5 minutes to improve performance.