My First Playground

node v8.17.0
version: 1.0.1
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const axios = require('axios') axios.interceptors.request.use(function (config) { // Do something before request is sent console.log(`url: ${config.url}`) console.log(`base url: ${config.baseURL}`) config.url = 'https://google.com' console.log(`url: ${config.url}`) return config }, function (error) { // Do something with request error return Promise.reject(error) }); axios.get('svc-a') .then(response => response.data) .then(data => { console.log(`response: ${data}`) }) .catch(error => { console.log(`Error:`, error.message) })
Loading…

no comments

    sign in to comment