Skip to content

Taurus1601/skill_lab_assignment2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

  1. Install dependencies:

    npm install
  2. Start the server:

    npm start

API Endpoints

Authentication

1. Login

  • Method: POST
  • URL: http://localhost:3000/api/auth/login
  • Body (JSON):
    {
      "username": "YourUsername",
      "password": "YourPassword"
    }

2. Register

  • Method: POST
  • URL: http://localhost:3000/api/auth/register
  • Body (JSON):
    {
      "username": "YourUsername",
      "password": "YourPassword"
    }

Blogs

3. Create New Blog

  • Method: POST
  • URL: http://localhost:3000/api/blogs/create
  • Body (JSON):
    {
      "title": "Blog Title",
      "content": "Blog Content",
      "category": "Blog Category"
    }

4. Retrieve All Blogs

  • Method: GET
  • URL: http://localhost:3000/api/blogs/all

5. Retrieve Blog by ID

  • Method: GET
  • URL: http://localhost:3000/api/blogs/get/{blogId}
    • Replace {blogId} with an actual ID.

6. Search Blogs

  • Method: GET
  • URL: http://localhost:3000/api/blogs/search/:query
    • Replace :query with your search title.

7. Update Blog by ID

  • Method: PUT
  • URL: http://localhost:3000/api/blogs/update/{blogId}
    • Replace {blogId} with an actual ID.
  • Body (JSON):
    {
      "title": "Updated Blog Title",
      "content": "Updated Blog Content",
      "category": "Updated Blog Category"
    }

8. Delete Blog by ID

  • Method: DELETE
  • URL: http://localhost:3000/api/blogs/delete/{blogId}
    • Replace {blogId} with an actual ID.

User

9. Retrieve All Users

  • Method: GET
  • URL: http://localhost:3000/api/auth/all-users

10. Retrieve User by ID

  • Method: GET
  • URL: http://localhost:3000/api/auth/get-user/:userId
    • Replace {userId} with an actual ID.

11. Delete User by ID

  • Method: DELETE
  • URL: http://localhost:3000/api/auth/delete-user/:userId
    • Replace {userId} with an actual ID.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published