1.1.3 • Published 10 months ago

axzod v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

AXZOD

Axzod is powered by Axios and Zod. It provides a way of typing your request responses using the power of Zod.

Example

import {createAxzod} from 'axzod'
import {z} from 'zod'

const TodoSchema = z.object({
    userId: z.number(),
    id: z.number(),
    title: z.string(),
    completed: z.boolean()
})

const instance = createAxzod({logging: true, baseURL: "https://jsonplaceholder.typicode.com"})


// Todo is now typed using the schema provided.
instance.get("/todos/1", TodoSchema).then(todo => console.log(todo.userId))

API

async get<T>(url: string, schema: z.ZodType<T>, config?: AxzodRequestConfig): Promise<T>
async delete<T>(url: string, schema: z.ZodType<T>, config?: AxzodRequestConfig): Promise<T>
async post<T>(url: string, schema: z.ZodType<T>, body?: any, config?: AxzodRequestConfig): Promise<T>
async put<T>(url: string, schema: z.ZodType<T>, body?: any, config?: AxzodRequestConfig): Promise<T>
async request<T>(config: AxzodRequestConfig, schema: z.ZodType<T>): Promise<T>

instance: AxiosInstance // The underlying AxiosInstance that Axzod is using. You can access this instance to modify the Axios instance yourself. This way you can add interceptors to your requests and responses.
1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago