title: Simulating an API call with Javascript
body: <p>I want to simulate an API calls. I am writing an application in VueJS, and I'm currently retrieving my data from a hardcoded JSON file I created.</p>
  
  <p>For example, from my <code>App.vue</code>:</p>
  
  <pre><code>&lt;template&gt;
    &lt;p&gt;{{ teams.yankees.city }}&lt;/p&gt; // Will output "New York"
  &lt;/template&gt;
  
  &lt;script&gt;
    import teams from './teams.json'
  
    export default {
      data() {
        return { teams }
      }
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>From my <code>teams.json</code> file:</p>
  
  <pre><code>{
    "yankees": [
      { "city": "New York", "established": 1901, "worldSeries": 27 } 
    ]
    ...
  }
  </code></pre>
  
  <p>I can as of now successfully retrieve my data from my local JSON file - but how can I instead retrieve data using "function stubs", in a way that will allow me to swap in real restful API calls in the future?</p>
  
  <p>Is there a barebones resource somewhere, that shows how to set up a mock rest service that calls my local JSON file?</p>