1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
import axios from "axios"; export class ApiClient { readonly url = "http://localhost:3000/api"; async get(path: string) { const request_url = `${ this.url }${ path }`; try { const response = await axios.get(request_url); return response; } catch(error) { return error.response; } } }