Better Fetch

Dynamic Parameters

Dynamic parameters are parameters that are defined in the url path. They are defined using the : prefix. When the request is made, the dynamic paramters will be replaced with the values passed in the params option.

fetch.ts
import {  } from "@better-fetch/fetch";
 
const  = ({
    : "http://localhost:3000",
})
 
const  = await ("/path/:id", {
    : {
        : "1"
    }
})
 
const  = await ("/repos/:owner/:repo", {
    : {
        : "octocat",
        : "hello-world"
    }
})

On this page

No Headings