title: Pushing to a Go/MongoDB backend with ReactJS
body: <p>I have built a backend using Go with a Mlab Database that I am now trying to Post to using a ReactJS frontend, but every time I try to Post I get a 405 error. I have tested the backend using Postman so I know it accepts Post requests, I must be missing something in React. Does anyone have any ideas as to what is missing? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { Component } from 'react';
  import '../Styles/App.css';
  
  
  class RSVP extends Component {
  
    submitRSVP = (e) =&gt; {
        e.preventDefault();
        let newRSVP = {
            first: e.target.first.value,
            last: e.target.last.value,
            attending: e.target.attending.value,
            children: e.target.children.value,
            adults: e.target.adults.value,
        }
        console.log(newRSVP);
        this.createRSVP(newRSVP)
      }
    async createRSVP(rsvp){
    const response = await fetch('https://infinite-mountain-41867.herokuapp.com/guests', {
        method: 'POST',
        body: JSON.stringify(rsvp),
        headers:{
          'Content-Type': 'application/json',
          'Accept': 'application/json',
  
        }
      })
      console.log(response);
      this.componentDidMount()
    }
  
  
  
  
    render() {
      return (
        &lt;div className="rsvp"&gt;
          &lt;h1 className = "rsvpHead"&gt; Please RSVP by November 1, 2018 &lt;/h1&gt;
          &lt;form className = "rsvpForm" onSubmit={this.submitRSVP}&gt;
            &lt;label&gt;Names of Invited Guests&lt;/label&gt;
            &lt;input type = "text" id = "first" className = "rsvpInput" placeholder="First Name" name = "first" formMethod = "POST" required/&gt;
            &lt;input type = "text" id = "last" className = "rsvpInput" placeholder="Last Name" name = "last" formMethod = "POST" required/&gt;
            &lt;label&gt;Attending?&lt;/label&gt;
            &lt;input type = "text" id = "attending" className = "rsvpInput" placeholder ="Yes/No" name="attending" formMethod = "POST" required/&gt;
            &lt;div className = "attending"&gt;
            &lt;input type = "number" id="adults" className = "rsvpInput adultNumber" placeholder = "# of Adults" name="adults" formMethod = "POST" required/&gt;
            &lt;input type = "number" id="children" className = "rsvpInput childNumber" placeholder = "# of Children" name="children" formMethod = "POST" required/&gt;
            &lt;/div&gt;
            &lt;button type = "submit"&gt;Submit&lt;/button&gt;
          &lt;/form&gt;
        &lt;/div&gt;
      );
    }
  }
  
  export default RSVP;</code></pre>
  </div>
  </div>
  </p>