Skip to content
/ hapic Public

A tiny & simple fetch based http client with a collection of different presets.

License

Notifications You must be signed in to change notification settings

tada5hi/hapic

Repository files navigation

HAPIC 🌐

main Known Vulnerabilities Conventional Commits

What is it?

"HTTP API Client" is a tiny & simple fetch based http client. It provides a convenient way to make HTTP requests.

Table of Contents

Features

  • ✨ Simple API
  • 🔄 Transform request payload & headers
  • 🛑 Hooks to intercept request and response
  • 🌐 Works in Node.Js, browser & workers environment
  • ❌ Throws an error on responses with a non 2xx status code
  • 🚀 Method shortcuts for GET, POST, PUT, ...
  • ⚙️ Extended options (e.g. baseURL)
  • 🎭 Proxy support

Documentation

To read the docs, visit https://hapic.tada5hi.net

Usage

The following code snippet should serve as a simple example and first impression.

import hapic from 'hapic';

const response = await hapic.post('https://example.com/users', {
    firstName: 'Max',
    lastName: 'Mustermann'
});

console.log(response);
// { data: xxx, headers: xxx, status: xxx, statusText: xxx }

Packages

The repository contains the following packages:

Base 🚀

hapic

This package contains a HTTP-Client based on fetch. IT provides a convenient way to make HTTP requests.

The client is extended by the Harbor, Vault, and OAuth2 clients, which provide additional functionality specific to those services.

Documentation

Harbor 🚢

@hapic/harbor

This client provides an easy way to interact with various domain endpoints such as repositories, projects, and more. The Harbor Image Registry is an open-source platform that enables users to store, manage, and distribute container images. The client offers a variety of abstractions to simplify interaction with the platform and speed up the development process. Whether you are an experienced developer or new to the world of container images, this API client is a powerful tool to get the most out of the platform.

Documentation

OAuth2 🛡️

@hapic/oauth2

This client provides an easy way to authenticate and authorize users, clients, robots, ... using OAuth2 and OpenID Connect standards. With this API client, developers can easily interact with the server's endpoints, such as authentication flows, token issuance, and user management. The client offers a range of abstractions to simplify interactions with the server and speed up the development process. Whether you are an experienced developer or new to OAuth2/OpenID, this API client is a powerful tool to help you implement secure users, clients & robots authentication and authorization in your applications.

Documentation

Vault 🔒

@hapic/vault

This client provides a convenient way to interact with various endpoints in Vault, such as secrets, engines, and more. Vault is a popular open-source tool used for securely storing and accessing sensitive data, such as passwords, API keys, and certificates. The client offers a range of abstractions to simplify interactions with Vault and streamline the development process. Whether you are a seasoned developer or new to the world of secrets management, this API client is a powerful tool to help you get the most out of Vault.

Documentation

License

Made with 💚

Published under MIT License.