NextJS_DOC/pages/api/axios/instance.js

19 lines
479 B
JavaScript
Raw Normal View History

2023-03-24 10:11:04 +00:00
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;