
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Minimal, type-safe REST client using JS proxies.
ℹ️ If you like this package, upvote this feature to be part of
unjs/ofetchMuch appreciated.
api.nested.users(1).get()api.nested.users["1"].get().post()uncreate uses ofetch for data fetching under the hood. Thus, every option available for ofetch is usable with uncreate as well!
Run the following command to add uncreate to your project.
pnpm install uncreate # or npm or yarn
import { createClient } from 'uncreate'
// The base URL default is `/`
const api = createClient()
uncreate inherits ofetch's options. Refer to the documentation for a complete list of options.
import { createClient } from 'uncreate'
// Set a custom base URL as needed
const api = createClient({
baseURL: 'https://jsonplaceholder.typicode.com',
})
Chain single path segments or path ids by a dot. You can even type the response of your request!
// GET request to <baseURL>/users
const users = await api.users.get<UserResponse>()
// For GET request you can add search params
// <baseURL>/users?search=john
const users = await api.users.get<UserResponse>({ search: 'john' })
To include dynamic API path segments, you have two options:
// Typed GET request to <baseURL>/users/1
const userId = 1
// … using the chain syntax:
const user = await api.users(userId).get<UserResponse>()
// … or the bracket syntax:
const user = await api.users[`${userId}`].get<UserResponse>()
Add the appropriate method to the end of your API call. The following methods are supported:
get()post()put()delete()patch()For HTTP request methods supporting a payload, add it to the method call:
// POST request to <baseURL>/users
const response = await api.users.post({ name: 'foo' })
$fetchimport { createClient } from 'uncreate'
const api = createClient({
baseURL: 'https://jsonplaceholder.typicode.com',
async onRequestError({ request, options, error }) {
console.log('[fetch request error]', request, error)
},
async onResponseError({ request, options, error }) {
console.log('[fetch response error]', request, error)
},
})
You can add/overwrite $fetch options on a method-level:
const response = await api.users.get({
headers: {
'Cache-Control': 'no-cache',
},
})
MIT License © 2022 Johann Schopplich
FAQs
Minimal, type-safe REST client using JS proxies
We found that uncreate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.