title: How to serve data for AJAX calls in a Vue.js-CLI project?
body: <ul>
  <li>I have a Vue.js CLI project working.</li>
  <li>It accesses data via AJAX from localhost port 8080 served by Apache.</li>
  <li>After I build the project and copy it to a folder served by Apache, it works fine and can access data via AJAX on that server.</li>
  <li>However, during development, since the Vue.js CLI website is being served by Node.js which is serving on a different port (8081), I get a cross-site scripting error) and want to avoid cross-site scripting in general.</li>
  </ul>
  
  <p>What is a way that I could emulate the data being provided, e.g. some kind of server script within the Vue.js-CLI project that would serve mock data on port 8081 for the AJAX calls during the development process, and thus avoid all cross-site scripting issues?</p>
  
  <h1>Addendum</h1>
  
  <p>In my <code>config/index.js</code> file, I added a proxyTable:</p>
  
  <pre><code>  dev: {
      env: require("./dev.env"),
      port: 8081,
      autoOpenBrowser: true,
      assetsSubDirectory: "static",
      assetsPublicPath: "/",
      proxyTable: {
        "/api": {
          target: "http://localhost/data.php",
          changeOrigin: true
        }
      },
  </code></pre>
  
  <p>And now I make my AJAX call like this:</p>
  
  <pre><code>axios({
      method: 'post',
      url: '/api',
      data: {
          smartTaskIdCode: 'activityReport',
          yearMonth: '2017-09',
          pathRewrite: {
            "^/api": ""
          }
      }
  </code></pre>
  
  <p>But now I see in my JavaScript console:</p>
  
  <blockquote>
    <p>Error: Request failed with status code 404</p>
  </blockquote>
  
  <h1>Addendum 2</h1>
  
  <p>Apparent axios has a problem with rerouting, so I tried it with vue-resource but this code is showing an error:</p>
  
  <pre><code>var data = {
      smartTaskIdCode: 'pageActivityByMonth',
      yearMonth: '2017-09'
  }
  this.$http.post('/api', data).then(response =&gt; {
      this.pageStatus = 'displaying';
      this.activity = response.data['activity'];
      console.log(this.activity);
  }, response =&gt; {
      this.pageStatus = 'displaying';
      console.log('there was an error');
  });
  </code></pre>