Open Source Blog Api

1. User Registration

Endpoint: POST /register

Create a new user account.

      
        {
          "Username": "example_user",
          "Password": "example_password"
        }
      
      
Copy

2. User Login

Endpoint: POST /login

Authenticate and log in a user.

      
        {
          "Username": "example_user",
          "Password": "example_password"
        }
      
      
Copy

3. User Logout

Endpoint: POST /logout

Log out the currently authenticated user.

          
            "Thanks for visiting."
          
          
Copy

4. User Profile

Endpoint: GET /profile

Retrieve the profile of the currently authenticated user.

          
            {
              "Username": "authenticated_user",
              "id": "user_id",
              
            }
          
        
Copy

5. Create Blog Post

/* Styles for screens below 440 pixels */

Endpoint: POST /post

Create a new blog post.

      
        {
          "title": "Example Title",
          "summary": "Brief summary of the blog post",
          "content": "Main content of the blog post",
          "file": "Image file for the blog post"
        }
      
      
Copy

6. Retrieve All Blog Posts

Endpoint: GET /post

Retrieve a list of all blog posts.

      
        [
          {
            "_id": "Blog post ID 1",
            "title": "Example Title 1",
            "summary": "Brief summary of the blog post 1",
            "content": "Main content of the blog post 1",
            "cover": "Path to the cover image 1",
            "author": "Author ID 1",
            "createdAt": "Timestamp of creation 1",
            "updatedAt": "Timestamp of last update 1"
          },
          {
            "_id": "Blog post ID 2",
            "title": "Example Title 2",
            "summary": "Brief summary of the blog post 2",
            "content": "Main content of the blog post 2",
            "cover": "Path to the cover image 2",
            "author": "Author ID 2",
            "createdAt": "Timestamp of creation 2",
            "updatedAt": "Timestamp of last update 2"
          },
          // more blog post response objects  .... 
        ]
      
      
Copy

7. Retrieve a Specific Blog Post

Endpoint: GET /post/:id

Retrieve details of a specific blog post by ID.

          
            {
              "_id": "Blog post ID",
              "title": "Example Title",
              "summary": "Brief summary of the blog post",
              "content": "Main content of the blog post",
              "cover": "Path to the cover image",
              "author": "Author ID",
              "createdAt": "Timestamp of creation",
              "updatedAt": "Timestamp of last update"
            }
          
          
Copy

8. Update Blog Post

Endpoint: PUT /post

Update details of an existing blog post.

      
        {
          "id": "Blog post ID",
          "title": "Updated Title",
          "summary": "Updated summary",
          "content": "Updated content",
          "file": "Updated image file"
        }
      
      
Copy