how to get axios html response code example
Example 1: axios api post request
import qs from 'qs';
const data = { 'bar': 123 };
const options = {
method: 'POST',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
data: qs.stringify(data),
url,
};
axios(options);
Example 2: axios response return html not json data
// use this after route not before route
if (process.env.NODE_ENV === 'production') {
app.use(express.static(resolve(process.cwd(), 'client/build')))
app.get('*', (req, res) => {
res.sendFile(resolve(process.cwd(), 'client/build/index.html'))
})
}