Skip to content

Instantly share code, notes, and snippets.

@niradler
Created January 22, 2018 00:06
Show Gist options
  • Save niradler/77e4046fe8a2314a13c947ae2538b059 to your computer and use it in GitHub Desktop.
Save niradler/77e4046fe8a2314a13c947ae2538b059 to your computer and use it in GitHub Desktop.
const config = {
url: 'https://book-store-adonis.herokuapp.com/api',
actions: {
get:{
method: 'GET',
path: '/book/:id'
}
}
}
class Server {
constructor(config) {
this.config = config
}
get(id) {
return axios({
method: this.config.actions['get'].method,
url: this.config.url.concat(this.config.actions['get'].path).replace(':id',id),
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment