NextJS_DOC/pages/api/axios/instance.js

19 lines
479 B
JavaScript

import axios from 'axios';
/* This is the base url for the backend server. */
const baseUrl = 'http://192.168.2.134:8000/'
/**
* @description Creating an instance of axios with the base url and headers.
* @author Avinash H
*/
const axiosInstance = axios.create({
baseURL: baseUrl,
headers: {
'Content-Type': 'application/json',
accept: 'application/json',
}
})
/* Exporting the axiosInstance object so that it can be imported into other files. */
export default axiosInstance;