Skip to content

Molted/todo-list-app

Repository files navigation

Todo list API with JWT Authentication ⚙️

Endpoints

Endpoint: /api/login

Request body:

{
  "email": "string",
  "password": "string"
}

Response body:

{
    "status": "success",
    "user": {
        "id": 3,
        "name": "Joshua Concepcion",
        "email": "joshuaconcepcion@gmail.com",
        ...
    },
    "authorization": {
        "token": "eyJ0eXAiOiJK...",
        "type": "bearer"
    }
}

Endpoint: /api/register

Request body:

{
  "name": "Joshua Concepcion",
  "email": "joshuaconcepcion@gmail.com",
  "password": "password"
}

Response body:

{
    "status": "success",
    "message": "User created successfully",
    "user": {
        "name": "Joshua Concepcion",
        "email": "joshuaconcepcion@gmail.com",
        ...
    },
    "authorization": {
        "token": "eyJ0eXAiOiJKV1Qi...",
        "type": "bearer"
    }
}

Endpoint: /api/logout

Requires JWT Bearer Token

Request body:

// Current Logged in User

Response body:

{
    "status": "success",
    "message": "Successfully logged out"
}

Endpoint: /api/refresh

Requires JWT Bearer Token

Request body:

// Current Logged in User

Response body:

{
    "status": "success",
    "user": {
        "id": 3,
        "name": "Joshua Concepcion",
        "email": "joshuaconcepcion@gmail.com",
        ...
    },
    "authorization": {
        "token": "eyJ0eXAiOiJKV1...",
        "type": "bearer"
    }
}

Endpoint: /api/todos

Requires JWT Bearer Token

Response body: (Getting all todos)

{
    "status": true,
    "todos": [
        {
            "id": 2,
            "title": "This is the second title",
            "description": "second description",
            "isComplete": 0,
            ...
        },
        {
            "id": 3,
            "title": "This is the third title (Updated)",
            "description": "third description (Updated)",
            "isComplete": 1,
            ...
        },
        ...
    ]
}

Endpoint: /api/todos

Requires JWT Bearer Token

Request body: (Creating a Todo)

{
    "title": "string",
    "description": "string",
}

Response body: (Created a Todo)

{
    "status": true,
    "message": "Todo created successfully.",
    "todo": {
        "title": "Readme.md",
        "description": "Update the Readme.md",
        ...
    }
}

Endpoint: /api/todos/3

Requires JWT Bearer Token

Response body: (Showing a specific Todo)

{
    "status": "success",
    "todo": {
        "id": 3,
        "title": "This is the third title (Updated)",
        "description": "third description (Updated)",
        "isComplete": 1,
        ...
    }
}

Endpoint: /api/todos/6

Requires JWT Bearer Token

Request body: (Updating a Todo)

{
    "title": "Sixth - Readme.md",
    "description": "Sixth - Update Readme.md",
    "isComplete": true
}

Response body: (Updated Todo)

{
    "status": true,
    "message": "Todo updated successfully.",
    "todo": {
        "id": 6,
        "title": "Sixth - Readme.md",
        "description": "Sixth - Update Readme.md",
        "isComplete": true,
        ...
    }
}

Endpoint: /api/todos/7

Requires JWT Bearer Token

Response body: (Deleting a specific Todo)

{
    "status": true,
    "message": "Todo deleted successfully."
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages