0

I am trying to post data in my database but every time I do try to dod it I get a 405 error. Also python has an error saying that I am submitting an empty list. Please point me in the right direction to solve this problem.

const axios = require('axios')
       let URL = 'http://127.0.0.1:5000/Walls/saveComments'
       let HEADERS = {'Content-Type': 'text/plain;charset=utf-8'}

      axios.post(URL, HEADERS, {
          'post': post,
          'time': time
        })
        .then(function (response) {
          console.log(response);
        })

       // Axios Call to Save A Post in Backend
     }
Bobby
  • 37
  • 2
  • 10
  • Looks like the order that you are passing the parameters to axios.post is incorrect. Can you try it like [here](https://stackoverflow.com/questions/51415439/how-can-i-add-raw-data-body-to-an-axios-request/51415624#51415624)? – Madhu Bhat Apr 17 '20 at 04:41
  • Did the above help? – Madhu Bhat Apr 20 '20 at 03:30

2 Answers2

0

Correct order for the post request is axios.post(url[, data[, config]]) .This may be helpful.

-1

it should be,,,

const axios = require('axios')
       let URL = 'http://127.0.0.1:5000/Walls/saveComments'
       let HEADERS = {'Content-Type': 'text/plain;charset=utf-8'}
const data = 'your data to post'

      axios.post(URL, data, {
           'headers': HEADERS,
          'post': post,
          'time': time
        })
        .then(function (response) {
          console.log(response);
        })

       // Axios Call to Save A Post in Backend
     }