title: Get data by id using Axios and VueJS
body: <p>I have this get-function on my server-side that I want to use to get a specific entry in my database by giving the ID as a parameter. In my VueJS application I've written an Axios get-call but it doesn't give me any data. It only says </p>
  
  <blockquote>
    <p>"Cannot GET ...".</p>
  </blockquote>
  
  <p>I know the ID I'm giving the function is correct so that's not the problem.</p>
  
  <p><strong>Client-side</strong>:</p>
  
  <pre><code>loadData() {
       axios.get('http://localhost:8080/route', {
          params: {
              id: this.selectedRoute
          }
       })
       .then(response =&gt; (this.chosenRoute = response.data));
  }
  </code></pre>
  
  <p><strong>Server-side</strong>:</p>
  
  <pre><code>app.get('/route/:id', function(req, res) {
      const routeId = req.params.id;
      Route.findById(routeId, (err, route) =&gt; {
          res.set("Access-Control-Allow-Origin", "*");
          res.json(route);
      });
  });
      enter code here
  </code></pre>