I am trying to fetch data from a rest API using AXIOS as below:
require('dotenv').config();
const axios = require('axios');
var url = 'https://931eb067-05c0-492a-8129-48ebfc27d426-bluemix.cloudant.com/dummy/_design/NEW_VIEW_DESIGN/_view/new-view?include_docs=true';
axios.get({url,auth: {
username: process.env.account,
password: process.env.password
}}).then((res)=>{console.log(res.data);})
.catch((e)=>{console.log(e)});
I am able to access the metioned URL seperately by providing the credentials but I am getting the below error while using AXIOS
The "url" argument must be of type string. Received type object at Url.parse
What has gone wrong?
auth
but you have it after it. – Discomfort