import { tf } from '../src/index.js' // Basic GET request async function basicExample() { console.log('=== Basic GET Request ===') const user = await tf.get('https://api.github.com/users/github') console.log('User:', user.name) console.log('Company:', user.company) } // POST request with data async function postExample() { console.log('\n=== POST Request ===') const response = await tf.post('https://jsonplaceholder.typicode.com/posts', { title: 'TypedFetch is awesome', body: 'Zero dependencies, just works!', userId: 1 }) console.log('Created post:', response) } // Error handling async function errorExample() { console.log('\n=== Error Handling ===') try { await tf.get('https://api.github.com/users/this-user-definitely-does-not-exist-404') } catch (error) { console.log('Caught error:', error.message) console.log('Status:', error.status) } } // Run examples async function main() { await basicExample() await postExample() await errorExample() } main().catch(console.error)