Base API client backed by axios

Usage no npm install needed!

<script type="module">
  import baseApiClient from '';



Base API client backed by axios.

Version Bundle size Downloads

CodeFactor SonarCloud Codacy Total alerts Language grade Scrutinizer

Dependencies Security Build Status Coverage Status

Commit activity FOSSA License

Table of Contents


Platform Status

To use library you need to have node and npm installed in your machine:

  • node >=10
  • npm >=6

Package is continuously tested on darwin, linux, win32 platforms. All active and maintenance LTS node releases are supported.


To install the library run the following command

  npm i --save base-api-client


Example of telegram client extended from BaseAPI:

import BaseAPi from 'base-api-client';

export default class TelegramAPI extends BaseAPi {
    constructor(id, token) {

    message(chatId, html) {
        return'sendMessage', {
            'parse_mode' : 'HTML',
            'text'       : html,
            'chat_id'    : chatId

    file(chatId, fileId) {
        return'sendDocument', {
            'document' : fileId,
            'chat_id'  : chatId

Constructor arguments:

  1. url - base URL of the API. Can consist apiPrefix. Will be cast to nodeJS URL object.
  2. options - object with next attributes:
    • timeout - timeout in ms format. Will be cast to integer (in milliseconds). Default: 1m.
    • logger - if applied, will add debug and verbose messages before and after each request. Should have next interface: logger.log(level, object).


Make the changes to the code and tests. Then commit to your branch. Be sure to follow the commit message conventions. Read Contributing Guidelines for details.