装饰器, HTTP请求与Typescript
0. 简单的API封装封装如下API:GET /resource/{id}
Response
200 {
_id: string;
name: string;
}
404;POST /resource
Payload {
name: string;
}
Response
201 {
_id: string;
name: string;
}
403;实现:class Client {
client: AxiosInstance;
constructor (baseUrl: string) {
this.client = axios.create(...