Skip to content

shujaurrahman/api.shujaurrahman.me

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shujaurrahman-API

Overview

The Shujaurrahman API serves as the backend data source for the portfolio website shujaurrahman.me. It provides endpoints to fetch various content, such as profiles, projects, social media links, and images used throughout the site. The API is designed to be lightweight, easy to use, and adaptable for future enhancements, including a dashboard for content management.

Why This API?

  • Separation of Concerns: By having a dedicated API, the frontend can remain focused on presentation while the backend handles data management.
  • Dynamic Content: Easily manage and update content without modifying the frontend code.
  • Scalability: The API can be extended with new endpoints and features as needed.
  • Future Enhancements: Plans to integrate a dashboard for real-time content updates, deletions, and additions.

Endpoints

The following endpoints are available in the API:

1. /api/public/about

Method: GET

Description: Fetches profile information, sections about the user, and contact details.

Response:

{
    "profile": {
        "image": "URL to profile image",
        "name": "Shuja Ur Rahman",
        "description": "User description..."
    },
    "sections": [ /* Array of sections */ ],
    "contact": {
        "email": "user email",
        "github": "URL to GitHub profile"
    }
}

2. /api/public/bookmarks

Method: GET

Description: Fetches bookmarks data for the user.

3. /api/public/colophon

Method: GET

Description: Provides information about the website's design and development credits.

4. /api/public/gallery

Method: GET

Description: Fetches image links for the gallery section.

5. /api/public/hireme

Method: GET

Description: Provides hiring information for the user.

6. /api/public/notes

Method: GET

Description: Fetches notes or blog post data.

7. /api/public/now

Method: GET

Description: Provides information about what the user is currently working on.

8. /api/public/projects

Method: GET

Description: Fetches project information and links.

9. /api/public/social-media

Method: GET

Description: Provides links to the user's social media profiles.

10. /api/public/status

Method: GET

Description: Fetches current status updates for the user.

11. /api/public/story

Method: GET

Description: Fetches stories with thumbnails and images.

12. /api/public/support

Method: GET

Description: Provides information on how users can support the creator.

13. /api/public/timeline

Method: GET

Description: Fetches timeline or history data for the user.

Static Content Fetching

The API serves static content by linking to media files hosted at the following base URL:

https://host/content/

When fetching content, the frontend retrieves relative paths from the JSON responses and constructs the full URL dynamically, eliminating the need for hardcoded URLs in the JSON files.

Example of Dynamic URL Construction

For instance, the JSON response for the about section may contain a relative path for the profile image:

{
    "profile": {
        "image": "profile/shuja.jpg"
    }
}

In the frontend, this path is combined with the base URL to construct the full URL:

const baseUrl = "https://host/content/";
const imageUrl = baseUrl + data.profile.image; // Results in full image URL

Future Enhancements

Future plans include developing a dashboard for managing content through a user-friendly interface. This will allow for real-time updates, deletions, and additions of data to the JSON files, making the API even more dynamic and easier to maintain.

Installation

To run the API locally:

  1. Clone the repository:
    git clone <repository-url>
    cd <repository-directory>
  2. Install dependencies:
    npm install
  3. Start the server:
    node server.js
  4. Access the API at http://localhost:3000/api/public/<endpoint>

About

API for shujaurrahman moving all backend content as api to further make the project dynamic.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published