← All @molecule/* packages · App templates

@molecule/api-http-fetch

Provider bond · http · API (Node) · v1.0.1 · Apache-2.0

Native fetch HTTP client provider

npm install @molecule/api-http-fetch

npm · Source on GitHub · Implements @molecule/api-http

How it works

@molecule/api-http-fetch is a provider bond on the API (Node) side: it implements the http core interface (@molecule/api-http) with a concrete vendor or library behind it.

Your code calls the core; you wire this provider once at startup. Swapping vendors later is one line in that wiring, not a rewrite.

import { setClient } from '@molecule/api-http'
import { provider } from '@molecule/api-http-fetch'

setClient(provider)

Works with: @molecule/api-http

Reference

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Native fetch HTTP client provider for molecule.dev.

Quick Start

import { setClient } from '@molecule/api-http'
import { provider } from '@molecule/api-http-fetch'

setClient(provider)

Type

provider

Installation

npm install @molecule/api-http-fetch @molecule/api-http

API

Constants

fetchClient

HTTP client using native fetch.

const fetchClient: HttpClient

provider

Default fetch-based HTTP provider.

const provider: HttpClient

Core Interface

Implements @molecule/api-http interface.

Bond Wiring

Setup function to register this provider with the core interface:

import { setClient } from '@molecule/api-http'
import { provider } from '@molecule/api-http-fetch'

export function setupHttpFetch(): void {
  setClient(provider)
}

Injection Notes

Requirements

Peer dependencies:

  • @molecule/api-http ^1.0.1

Runtime Dependencies

  • @molecule/api-http