npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

apis-management

v1.0.13

Published

## Introduction apis management is a tool to manage APIs, There are two main purposes of this tool: 1. To document your APIs to make it easy to the your backend developers to understand how to implement the APIs. 2. To call your APIs in one line of code

Downloads

65

Readme

apis management

Introduction

apis management is a tool to manage APIs, There are two main purposes of this tool:

  1. To document your APIs to make it easy to the your backend developers to understand how to implement the APIs.
  2. To call your APIs in one line of code

Usage

Installation

npm install apis-management

Setting your APIs

import type { ApiRequest } from "apis-management";
export const apis = [
  // Here your APIs
] as const satisfies ReadonlyArray<ApiRequest>;

Calling your APIs

import { apiCall } from "apis-management";

const example = await apiCall(apis,apiName, apiParams, apiBody, apiHeaders);
example.// here your API response

Explanation

apis

This is an array of API requests. Each API request should be defined as an object with the following properties:

| Property | Type | Description | |-----------------------|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | name | string | The name of the API request. The name only for the API call | | description | string | A brief description of the API request. | | url | string | The URL of the API endpoint without the domain. It should start with /. | | status | boolean | this property can be very confusing, it is used to enable or disable the API request. If the API request is disabled, not status like 404 or 500, it will not be called. | | params | Record<string, string> \| null | An object containing the query parameters for the API request. If there are no query parameters, it should be null by default. | | body | Record<string, any> \| null | An object containing the body of the API request. If there is no body, it should be null by default. |
| headers | Record<string, string> \| null | An object containing the headers for the API request. If there are no headers, it should be null by default. | | method | string | The HTTP method for the API request (e.g., GET, POST, PUT, DELETE). | | goodResponse | object | An object contaninig the response if the API sucsessful | | errorResponse | object | An object contaninig the response if the API failed | | goodResponseStatus | number | The HTTP status code for a successful response. | | errorResponseStatus | number | The HTTP status code for an error response. | | comment | string | A comment for the API request. This is optional and can be used to provide additional information about the API request. |

apiCall

This function is used to call an API request from the apis array. It takes the following parameters:

| Parameter | Type | Description | |--------------|----------------------------------------|--------------------------------------------------------------------------------------------------| | apis | ReadonlyArray<ApiRequest> | The array of API requests. | | apiName | string | The name of the API request to call. | | apiParams | Record<string, string> \| null | An object containing the query parameters for the API request. If there are none, use null. | | apiBody | Record<string, any> \| null | An object containing the body of the API request. If there is none, use null. | | apiHeaders | Record<string, string> \| null | An object containing the headers for the API request. If there are none, use null. |

Example

import { apiCall } from "apis-management";
import type { ApiRequest } from "apis-management";
const apis = [
  {
    name: "getUser",
    description: "Get user by id",
    url: "/users/:id",
    status: true,
    params: { id: "123" },
    body: null,
    headers: null,
    method: "GET",
    goodResponse: { id: "123", name: "John Doe" },
    errorResponse: { error: "User not found" },
    goodResponseStatus: 200,
    errorResponseStatus: 404,
    comment: "This API gets a user by id"
  }
] as const satisfies ReadonlyArray<ApiRequest>;         


const example = await apiCall(apis, "getUser", { id: "123" }, null, null);

Tasks server component

this is a component that show the tasks. if you call the TasksServer component, it will show toggle button, when you click on it, it will show the tasks that you defined in the apis array. if you click again, it will hide the tasks.


import { TasksServer } from "apis-management";
import apis from "./apis";
import 'apis-management/dist/tasksServer.css'
export default function App() {
  return (
    <div>
      <TasksServer apis={apis} />    
    </div>
  );
}

Created with ❤️ by Yehonatan Refael Cohen. Feel free to contribute or give a ⭐️.