uloamaka / Todo_Apis

A complete Todo Apis hosted with cloudflare stacks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Todo_Apis

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Todo_Apis

A complete Todo Apis, this api allows you to create todo task, read, update and delete todo task. It handle authentication of user, allowing only authenticated user to create and access todo task
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

![Product Name Screen Shot][product-screenshot]

Here's a blank template to get started: To avoid retyping too much info. Do a search and replace with your text editor for the following: github_username, repo_name, twitter_handle, linkedin_username, email_client, email, project_title, project_description

(back to top)

Built With

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

Installation

  1. Get API Key at env_example.md, change to your own KEY
  2. Clone the repo
    git clone https://github.com/<your_github_username>/Todo_Apis.git
  3. Install NPM packages
    npm install
  4. Enter your API in .env
    const API_KEY = 'ENTER YOUR API';

(back to top)

Response Utility Functions | Usage

res.ok(payload, meta)

This function is used to send a successful response (HTTP status code 200) with a payload and optional metadata. The payload parameter represents the data to be sent in the response body, while the meta parameter is an optional object containing additional information about the response e.g pagination data.

res.created(payload)

Use this function to send a response indicating that a resource has been successfully created (HTTP status code 201). The payload parameter represents the data of the newly created resource.

res.noContent()

This function sends a response with no content (HTTP status code 204). It is typically used for successful requests that do not require a response body.

Custom Error Classes

Instead of using res.error directly, this template encourages the use of custom error classes for handling and responding to errors. These classes simplify error handling by providing consistent error structures and HTTP status codes. The following custom error classes are available:

  • BadRequest: Represents a 400 Bad Request error. It takes a message parameter as the error message and an optional errorCode parameter to identify the specific error.
  • Unauthorized: Represents a 401 Unauthorized error. It takes a message parameter as the error message and an optional errorCode parameter.
  • Forbidden: Represents a 403 Forbidden error. It takes a message parameter as the error message and an optional errorCode parameter.

To throw one of these custom errors, simply create a new instance of the appropriate error class and throw it with the desired error message and error code.

Finding Error Codes

A list of all error codes can be found in the httpErrorCode.js file. This file provides a comprehensive collection of HTTP status codes and their corresponding error codes. You can refer to this file to find the appropriate error code when throwing a custom error.

NPM Commands

The following npm commands are available for managing and running the Express application:

  • npm run dev: Starts the development server. This command is used during the development process to run the application with automatic reloading on code changes.

  • npm start: Starts the production server. This command is used to run the application in a production environment.

Feel free to modify and use these commands according to your specific application needs.

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • Authentication
  • Todo task
    • full CRUD

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Your Name - @ebitegift235 - ebitegift235@gmail.com

Project Link: https://github.com/uloamaka/Todo_Apis

(back to top)

About

A complete Todo Apis hosted with cloudflare stacks

License:MIT License


Languages

Language:JavaScript 100.0%