/devtools-companion

The DevTools Companion API is a Node.js Express application that provides endpoints for various developer tools, including color conversion, JSON manipulation, Markdown rendering, and more.

Primary LanguageTypeScript

DevTools Companion API

The DevTools Companion API is a Node.js Express application that provides endpoints for various developer tools, including color conversion, JSON manipulation, Markdown rendering, and more.

Table of Contents

  1. Installation
  2. Usage
  3. Endpoints
  4. Error Handling
  5. Contributing

Installation

To run the DevTools Companion API locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/zahidhasann88/devtools-companion.git
    cd devtools-companion
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    Create a .env file in the root directory with the following environment variables:

    PORT=5000
    MONGODB_URI=mongodb://localhost:27017/devtools
    

    Adjust MONGODB_URI as per your MongoDB setup.

  4. Start the server:

    npm start

    The API server will start running at http://localhost:5000.

Usage

Once the server is running, you can use tools like Postman or curl to interact with the API endpoints. Make sure to refer to the Endpoints section below for detailed information on available routes and their usage.

Endpoints

Authentication Routes

  • POST /api/auth/register: Register a new user.
  • POST /api/auth/login: Log in an existing user.

JSON Manipulation Routes

  • POST /api/json/flatten: Flatten a JSON object.
  • POST /api/json/parse: Parse a JSON string.

Markdown Rendering Routes

  • POST /api/markdown/render: Render Markdown to HTML.

Color Conversion Routes

  • POST /api/color/convert: Convert color between HEX and RGB formats.

Regex Validation Routes

  • POST /api/regex/validate: Validate input against a regular expression.

For detailed request and response formats, refer to each route's respective documentation in the codebase or use tools like Swagger for API documentation.

Error Handling

The API handles errors gracefully and returns appropriate HTTP status codes along with error messages in JSON format. Middleware functions are used for centralized error handling to ensure consistency.

Contributing

Contributions are welcome! If you have any suggestions, improvements, or feature requests, feel free to open an issue or create a pull request.