Naughty Programmer's Madness
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

@t2ee/restful

1.0.3 • Public • Published

Introduction

@t2ee/restful allows you to write restful clients that have verbal meanings, easy to read and easy to code.

For detailed introduction and examples, please visit core.t2ee.org.

Installation

npm i reflect-metadata @t2ee/core @t2ee/restful -S

Basic Example

interface Repository {
    id: number;
    name: string;
    //...
}
 
class GithubRepo {
    @GET('/users/{username}/repos')
    listUserRepos(@Path('username') username: string, @Query('type') type): Promise<Repository[]> {return null}
}
 
const builder = new RestfulService().baseUrl('https://api.github.com/');
const client = builder.create(GithubRepo);
 
const repos = await client.listUserRepos('t2ee', 'all');
 

install

npm i @t2ee/restful

Downloadsweekly downloads

5

version

1.0.3

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability