open-index/open-npm huggingface dataset:
npm package: @http-util/status-i18n
Description: Make HTTP status message support i18n
Author: Kimi Gao
Latest version: 0.9.0

# status-i18n

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][ci-image]][ci-url]
[![Test Coverage][coveralls-image]][coveralls-url]

HTTP status and message mapping, internationalized.

Currently supported locales: `de-de`, `en-us`, `ja-jp`, `ko-kr`, `zh-cn`. Add your locale [like this](https://github.com/http-util/status-i18n/pull/48) now! 🎉

## Installation

```sh
$ npm install @http-util/status-i18n
```

## API

```js
import status from '@http-util/status-i18n'
// or
var status = require('@http-util/status-i18n')
```

### status.BROWSER_LANG

Returns a lowercase string of default browser language set by user.

### status.codes

Returns an array of all the status codes as `Integer`s.

### status[code]

Map of `code` to `status message`, in the same format as the [Node.js http module](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes). `undefined` for invalid `code`s. The language has been set to default `en-us`.

```js
status[404] // => 'Not Found'
status[700] // => undefined
```

### status(code, language)

Map of `code` to `status message` with specific language. The default browser language is assumed to be `en-us`.

```js
status(401, 'zh-cn') // => '无权限'
status(401, 'zh-CN') // => '无权限'
status(401, 'zh') // => '无权限'
status(401, status.BROWSER_LANG) // => 'Unauthorized'
status(401) // => 'Unauthorized'
```

[ci-image]: https://img.shields.io/github/actions/workflow/status/http-util/status-i18n/ci.yml
[ci-url]: https://github.com/http-util/status-i18n/actions/workflows/ci.yml
[npm-image]: https://img.shields.io/npm/v/@http-util/status-i18n.svg
[npm-url]: https://npmjs.org/package/@http-util/status-i18n
[node-version-image]: https://img.shields.io/node/v/@http-util/status-i18n.svg
[node-version-url]: https://www.npmjs.com/package/@http-util/status-i18n
[coveralls-image]: https://img.shields.io/coveralls/http-util/status-i18n.svg
[coveralls-url]: https://coveralls.io/github/http-util/status-i18n?branch=master
[downloads-image]: https://img.shields.io/npm/dm/@http-util/status-i18n.svg
[downloads-url]: https://npmjs.org/package/@http-util/status-i18n
npm package: @http-utils/hateoas
Description: Simple framework for HATEOAS
Author: Naresh Bhatia
Latest version: 2.0.0

# HATEOAS

A simple framework for implementing HATEOAS.

The interfaces in this package are based on concepts from:

1. [JSON Hypertext Application Language](https://tools.ietf.org/id/draft-kelly-json-hal-05.xml#link-objects)
2. [Spring HATEOAS](https://docs.spring.io/spring-hateoas/docs/1.2.0-RC1/api/)
npm package: @http-wizard/core
Description: <h1 align="center">http-wizard</h1> <p align="center"><a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=18&duration=2000&pause=2000&center=true&width=540&height=80&lines=First+class+api+client+for+node
Author: flodlc
Latest version: 1.3.20

<h1 align="center">http-wizard</h1>
<p align="center"><a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=18&duration=2000&pause=2000&center=true&width=540&height=80&lines=First+class+api+client+for+node+servers." alt="Typing SVG" /></a></p>

### Full documentation website:

[http-wizard.vercel.app](https://http-wizard.vercel.app)

## Introduction

Http-wizard weaves TypeScript magic, offering a type-safe API client and ensuring a delightful end-to-end developer experience. ✨

#### Here is an example of usage

https://github.com/flodlc/http-wizard/assets/3781663/71c749f0-3493-4865-8a9a-41421a371a05

### What it can do:

- 100% type-safe api client with typescript magic (no code generation)
- Fastify first-class support
- React-query first-class support
- Zod and Typebox Type providers
- Delightful end-to-end developer experience (tRPC-like)
- Http standards / REST compatibility: you are owner of your routes
- Type inference utils

---

Table of Contents:

- [Installation](#installation)
- [Usage](#usage)

---

## Installation

To get started, install http-wizard using npm or yarn:

```sh
npm install @http-wizard/core
# or
yarn add @http-wizard/core
```

## Usage

Currently http-wizard uses Zod or Typebox for validation.
Here is an example with Zod.

Let's first create a route on the server:

```typescript title="Route creation with Fastify and Zod"
// server.ts
import { createRoute } from '@http-wizard/core';
import { z } from 'zod';

const User = z.object({
  id: z.string(),
  name: z.string(),
});

export const getUsers = (fastify: FastifyInstance) => {
  return createRoute('/users', {
    method: 'GET',
    schema: {
      response: {
        200: z.array(User),
      },
    },
  }).handle((props) => {
    fastify.route({
      ...props,
      handler: (request) => {
        const users = await db.getUsers();
        return users;
      },
    });
  });
};

const router = { ...getUsers() };
export type Router = typeof router;
```

Now, let's use the Router type on the client:

```typescript title="Client instanciation with axios"
// client.ts
import { createClient, ZodTypeProvider } from '@http-wizard/core';
import axios from 'axios';

import type { Router } from './server';

const apiClient = createClient<Router, ZodTypeProvider>(axios.instance());
const users = await apiClient.ref('[GET]/users').query({});
// users array is safe: { id:string, name:string }[]
```

Easy, right?
npm package: @http-wizard/react-query
Description: <h1 align="center">http-wizard</h1> <p align="center"><a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=18&duration=2000&pause=2000&center=true&width=540&height=80&lines=First+class+api+client+for+node
Author: flodlc
Latest version: 1.3.20

<h1 align="center">http-wizard</h1>
<p align="center"><a href="https://git.io/typing-svg"><img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=18&duration=2000&pause=2000&center=true&width=540&height=80&lines=First+class+api+client+for+node+servers." alt="Typing SVG" /></a></p>

### Full documentation website:

[http-wizard.vercel.app](https://http-wizard.vercel.app)

## Introduction

Http-wizard weaves TypeScript magic, offering a type-safe API client and ensuring a delightful end-to-end developer experience. ✨

#### Here is an example of usage

https://github.com/flodlc/http-wizard/assets/3781663/71c749f0-3493-4865-8a9a-41421a371a05

### What it can do:

- 100% type-safe api client with typescript magic (no code generation)
- Fastify first-class support
- React-query first-class support
- Zod and Typebox Type providers
- Delightful end-to-end developer experience (tRPC-like)
- Http standards / REST compatibility: you are owner of your routes
- Type inference utils

---

Table of Contents:

- [Installation](#installation)
- [Usage](#usage)

---

## Installation

To get started, install http-wizard using npm or yarn:

```sh
npm install @http-wizard/core
# or
yarn add @http-wizard/core
```

## Usage

Currently http-wizard uses Zod or Typebox for validation.
Here is an example with Zod.

Let's first create a route on the server:

```typescript title="Route creation with Fastify and Zod"
// server.ts
import { createRoute } from '@http-wizard/core';
import { z } from 'zod';

const User = z.object({
  id: z.string(),
  name: z.string(),
});

export const getUsers = (fastify: FastifyInstance) => {
  return createRoute('/users', {
    method: 'GET',
    schema: {
      response: {
        200: z.array(User),
      },
    },
  }).handle((props) => {
    fastify.route({
      ...props,
      handler: (request) => {
        const users = await db.getUsers();
        return users;
      },
    });
  });
};

const router = { ...getUsers() };
export type Router = typeof router;
```

Now, let's use the Router type on the client:

```typescript title="Client instanciation with axios"
// client.ts
import { createClient, ZodTypeProvider } from '@http-wizard/core';
import axios from 'axios';

import type { Router } from './server';

const apiClient = createClient<Router, ZodTypeProvider>(axios.instance());
const users = await apiClient.ref('[GET]/users').query({});
// users array is safe: { id:string, name:string }[]
```

Easy, right?
npm package: @http.cat/http-cat-element
Description: Custom element that embeds HTTP Cats images
Author: rogeriopvl
Latest version: 1.0.0

# http-cat

<img src="https://http.cat/204" alt="http status cat 204" width="250">

This is a web component for embedding images from [HTTP Cats](https://http.cat).

Here's a [live demo](http://httpcats.github.io/http-cat-element).

## Install

```shell
npm install @http.cat/http-cat-element
```

## Import

If installed via NPM:

```js
import "@http.cat/http-cat-element";
```

Or just import the component file in your HTML:

```html
<script type="module" src="http-cat.js"></script>
```

## Usage

To use it just add the following markup to your HTML:

```html
<http-cat status="404"></http-cat>
```

### Attributes

- `status`: change it so that the image matches the corresponding HTTP status code

This component supports all `img` element attributes.

## Why didn't you extend the `img` native element instead?

Safari does not currently support custom elements that extend native elements. Therefore, an autonomous custom element is used to ensure maximum browser compatibility.

## LICENSE

MIT License