1.0.3 • Published 3 years ago
servih v1.0.3
jooscode
My first contribution, simple https service provider to optimize works.
Pre requirements 📋
Install 🔧
npm i servih
or
yarn add servih
Example⌨️
create a .env.js file, at the root of the project
module.exports = "https://jsonplaceholder.typicode.com";
in main.js add servihOptions.
import {servihOptions} from 'servih'
servihOptions('use api token');
in your component, or store use. Has support (get, post, put, delete)
import {serviHttp} from 'servih'
export default {
mounted() {
this.test();
},
methods:{
test:function(){
serviHttp('posts', 'post', {name:'josedaniel'}).then(response=>{
console.log(response);
}).catch(errors=>{
console.log(errors);
});
}
}
}
Built with 🛠️
- axios - Promise based HTTP client for the browser and node.js