Skip to content

Commit

Permalink
chore: release hypf 0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
fzn0x committed May 8, 2024
1 parent 35f4f07 commit 844483f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ npm install hypf
bun install hypf
```

The idea of this tool is to provide frontend-only lightweight solution for fetching APIs with an easy wrapper:
The idea of this tool is to provide lightweight `fetch` wrapper for Node.js, Bun:

```js
import hypf from "hypf";
Expand All @@ -36,7 +36,38 @@ if (postErr) {
}
```

or browsers
Cloudflare Workers:

```ts
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
const hypfInstance = await hypf.createRequest(
"https://jsonplaceholder.typicode.com"
);

const [getErr, getData] = await hypfInstance.get<
Array<{
userId: number;
id: number;
title: string;
body: string;
}>
>("/posts");

if (getErr) {
console.error("GET Error:", getErr);
}

return Response.json(getData);
},
};
```

and Browsers:

```html
<script src="https://unpkg.com/hypf/dist/hyperfetch-browser.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypf",
"version": "0.0.5",
"version": "0.0.6",
"description": "Supertiny and stunning HTTP client for frontend apps. Best frontend wrapper for Fetch API.",
"main": "./dist/Hyperfetch.js",
"repository": "fzn0x/hypf",
Expand Down

0 comments on commit 844483f

Please sign in to comment.