1.0.3 • Published 5 years ago
servih v1.0.3
jooscode
My first contribution, simple https service provider to optimize works.
Pre requirements 📋
Install 🔧
npm i servihor
yarn add servihExample⌨️
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