Skip to content

Getting Started

Dvori is a tool for crafting advanced HTTP clients with ease. Whether you’re integrating with complex APIs or need fine-grained control over your requests, Dvori’s here to simplify the process.

Installation

Terminal window
npm install dvori

Your First Request

Let’s make your first API request to see Dvori in action:

  • Define Your Client: Create a client instance with defineClient(), setting a baseURL for your target API.
  • Make a GET Request: Use client.get('/your-endpoint') to fetch data.

Example:

typescript
import { defineClient } from 'dvori';
// Initialize the Dvori client with optional global configurations
const client = defineClient({
baseURL: 'https://api.example.com',
});
// Make a GET request to retrieve data
client.get('/data')
.then(response => console.log(response))
.catch(error => console.error(error));

What You Accomplished: You’ve just sent a real API request using Dvori. This simple example illustrates how Dvori streamlines HTTP requests, but there’s much more you can do.

Next Steps

  • Explore Composables: Learn how to customize requests and responses with Dvori’s composables.
  • Dive Deeper: Check out the documentation for advanced features like streaming support and creating API clients.