Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 571 Bytes

File metadata and controls

29 lines (23 loc) · 571 Bytes

RepositoryHttp

Usage

import { HttpClient, RepositoryHttp } from '@volverjs/data'

class User {
    name: string
    surname: string
    constructor(data: { id: number, name: string, surname: string }) {
        this.id = data.id
        this.name = data.name
        this.email = data.email
    }

    get fullName() {
        return `${this.name} ${this.surname}`
    }
}

const client = new HttpClient({
    prefixUrl: 'https://api.example.com'
})

const repository = new RepositoryHttp<User>(client, 'users/:group?/:id?', {
    class: User
})