Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
apinspector-react
Advanced tools
Import in your ReactJS project to log the request and responses. Install APINSPECTOR desktop application and monitor the API logs
Import this file in your ReactJS project to log the request and responses. Install APINSPECTOR desktop application and monitor the API logs.
Desktop applications are available for Windows, Linux & Mac
APINSPECTOR supports the following networking libraries in React.
Sample Axios file
import axios from "axios"
import inspector from 'apinspector-react'
let instance = axios.create({
baseURL: "server url",
timeout: 10000,
headers: {
"Content-Type": "application/json"
}
});
//Initialize logger with your API Key
inspector.init("your APINSPECTOR apikey")
//Request interceptor
instance.interceptors.request.use( (config)=> {
return inspector.getAxiosRequestConfig(config)
},
(error)=> {
return Promise.reject(error);
});
//Response interceptor
instance.interceptors.response.use(
response => {
inspector.sendRequestMetrics(response,'axios')
return response.data
},
error => {
return null
});
export default class api {
static async getProfile(userid) {
return await instance.get("getprofile/"+userid)
}
}
import {create} from 'apisauce';
import inspector from 'apinspector-react'
const api = create({
baseURL: "server url",
headers: {'Accept': 'application/json'},
});
//Initialize logger with your API Key
inspector.init("your APINSPECTOR apikey")
//Request interceptor
api.addAsyncRequestTransform(config => async () => {
return inspector.getAxiosRequestConfig(config)
},(error) => {
return Promise.reject(error);
})
//Response interceptor
api.addAsyncResponseTransform(response => async () => {
inspector.sendRequestMetrics(response, 'apisauce')
return response.data
},error => {
return null
})
export default class api {
static async getProfile(userid) {
return await api.get("getprofile/"+userid)
}
}
MIT
FAQs
Import in your ReactJS project to log the request and responses. Install APINSPECTOR desktop application and monitor the API logs
We found that apinspector-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.