Skip to content

eqpoqpe/ts-ice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reice

coming soon..

Usage

Firstly, set compilerOptions.moduleResolution be Bundler to your project tsconfig.json.

Examples

Easily define your client

import { ReiceRest, convertRouteParamsToUrlString } from "reice";

const apiConstants = {
  "Say hello": "say/:text" as const,
};

export class MyClient extends ReiceRest {
  async sayHello(text: string) {
    return await this._axios.get(
      convertRouteParamsToUrlString(apiConstants["Say hello"], { text }),
    );
  }
}

Now say 👋

import axios from "axios";

const myClient = new MyClient({
  instance: axios.create(),
  baseURL: "https://api.example.com",
});

await myClient.sayHello("hello");

👉 more examples

Contributing

We welcome contributions to enhance the functionality and usability of this utility. Feel free to submit issues for bug reports or feature requests, and create pull requests to suggest improvements or fixes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

🍨 The easy way to make your clear REST client library.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published