@yme/api
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

@yme/api

A simple API client for TypeScript.

Quick Start

const router = createRouter();
const api = createApi({
  http: fetch,
  routes: {
    users: {
      list: router.get('/users'),
      create: router.post('/users').validator(z.object({
        username: z.string().min(1),
        password: z.string().min(1),
        age: z.number().optional(),
      })).T<{
        id: number;
        username: string;
        age?: number;
      }>(),
    },
  }
});

api.users.create({
  username: 'john',
  password: 'password',
  age: 30,
}).then((user) => {
  console.log(user);
});

api.users.list().then((users) => {
  console.log(users);
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.0-alpha.451next
1.4.128latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.0-alpha.451
2.0.0-alpha.34
2.0.0-alpha.21
2.0.0-alpha.11
2.0.01
1.4.128
1.4.00
1.3.00
1.2.00
1.1.10
1.1.00
1.0.20
1.0.00
0.6.10
0.6.0-beta.50
0.6.0-beta.41
0.6.0-beta.30
0.6.0-beta.20
0.6.0-beta.10
0.6.00
0.5.00
0.4.10
0.4.00
0.3.00
0.2.10
0.2.00
0.1.30
0.1.20
0.1.10
0.1.00
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i @yme/api

Weekly Downloads

87

Version

1.4.1

License

MIT

Unpacked Size

91.2 kB

Total Files

41

Last publish

Collaborators

  • minosss