mittwald / mittwald/api-client-js

Generator: simply overwrite axios baseurl

Open
#108 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
2
Forks
0
Avg merge
4d 16h
Merged PRs (30d)
4

Description

The axios baseURL is the target of any api request. To set it you currently have to do something like this:

const client = new ShareSecretApiClient();
client.axios.defaults.baseURL = "https://api.domain.tld";

Thats not simple or even intuitive.

Proposed Solution

To make this more user-friendly, we could introduce an option to set the baseURL directly in the ApiClient constructor. This way, users can easily configure the baseURL when creating an instance of the client. Here's an example of how this might look:

const client = new ShareSecretApiClient({ baseURL: "https://api.domain.tld" });

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the generated ApiClient constructor and the current axios.defaults.baseURL assignment. Trace how constructor options reach the client, then verify that passing baseURL when creating ShareSecretApiClient changes the target used by API requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.