Skip to content

Instantly share code, notes, and snippets.

@NovoManu
Last active August 18, 2019 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NovoManu/bab231658be4b80d3defde32ad755dc1 to your computer and use it in GitHub Desktop.
Save NovoManu/bab231658be4b80d3defde32ad755dc1 to your computer and use it in GitHub Desktop.
export class Api {
private baseUrl: string = 'https://jsonplaceholder.typicode.com/'
constructor(private url: string) {}
async fetch() {
const response = await fetch(`${this.baseUrl}${this.url}`)
return await response.json()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment