No description
Find a file
Joey Vos a523c70ac3
All checks were successful
ci/woodpecker/push/test Pipeline was successful
test
2025-02-08 10:37:14 +01:00
.woodpecker test 2025-02-08 10:37:14 +01:00
.yarn/releases Initial Commit 2023-10-01 16:35:47 +02:00
packages feat: add mock http client class 2023-10-08 11:49:00 +02:00
tools/scripts feature(http-client): initial setup 2023-10-02 20:09:08 +02:00
.editorconfig Initial Commit 2023-10-01 16:35:47 +02:00
.eslintignore Initial Commit 2023-10-01 16:35:47 +02:00
.eslintrc.json Initial Commit 2023-10-01 16:35:47 +02:00
.gitattributes Initial Commit 2023-10-01 16:35:47 +02:00
.gitignore Initial Commit 2023-10-01 16:35:47 +02:00
.gitlab-ci.yml feature(http-client): initial setup 2023-10-02 20:09:08 +02:00
.prettierignore Initial Commit 2023-10-01 16:35:47 +02:00
.prettierrc Initial Commit 2023-10-01 16:35:47 +02:00
.yarnrc.yml Initial Commit 2023-10-01 16:35:47 +02:00
CHANGELOG.md chore(release): http-client 1.2.0 2023-10-08 09:51:40 +00:00
jest.config.ts Initial Commit 2023-10-01 16:35:47 +02:00
jest.preset.js Initial Commit 2023-10-01 16:35:47 +02:00
nx.json Initial Commit 2023-10-01 16:35:47 +02:00
package.json chore(release): http-client 1.2.0 2023-10-08 09:51:40 +00:00
project.json feature(http-client): initial setup 2023-10-02 20:09:08 +02:00
README.md Initial Commit 2023-10-01 16:35:47 +02:00
renovate.json Add renovate.json 2025-02-07 21:45:48 +01:00
tsconfig.base.json Initial Commit 2023-10-01 16:35:47 +02:00
yarn.lock feature(http-client): initial setup 2023-10-02 20:09:08 +02:00

@jojoxd/http-client

A Simple HTTP Client using ky and TsED json-mapper

Installation

yarn install @jojoxd/http-client

Usage

Standalone and Browser

import { HttpClient } from '@jojoxd/http-client';

const client = new HttpClient();

const response = await client.get('https://example.org/');

TsED

NOTE: This requires @tsed/di to be installed.

// Server.ts

import '@jojoxd/http-client/tsed';

@Configuration(...)
export class Server {}

// Service.ts
import { Service, Inject } from '@tsed/common';
import { HttpClient } from '@jojoxd/http-client';

@Service()
class Service
{
    @Inject()
    protected readonly client!: HttpClient;

    async doSomething(): Promise<void>
    {
        await this.client.get('https://example.org');
    }
}

Vue

// main.ts

import { createApp } from 'vue';
import { createHttpClient } from '@jojoxd/http-client/vue';

const app = createApp(RootComponent);

app.use(createHttpClient(/* Options */));

// Component, Composition function etc.
import { HttpClient } from '@jojoxd/http-client/vue';
import { inject } from 'vue';

function composedFunction()
{
    const client = inject(HttpClient);

    client.get('https://example.org/').then((data) => {});
}