title: Vue.js: define a service
body: <p>I'm looking at Vue.js as an alternative to Angular and I really like it so far.
  To get a feeling for it, I'm refactoring an existing Angular project to a Vue project. I'm just at the point where I need to communicate with my REST API. </p>
  
  <p>In Angular I used to define a service for that, that was injected into every controller that needed it. Vue doesn't seem to know the "service" construct as I understand. How can this be achieved in Vue?</p>
  
  <p>I considered <code>vue-resource</code>, but it's only for http functionalities as far as I understand. As I use jQuery too, this is obsolete.</p>
  
  <p>Example:</p>
  
  <p>I have <code>vueComponent1</code> and <code>vueComponent2</code>. Both need access to the same REST resource. To handle this I want a central service, which both of the components can use for requests to the REST resource. Angular has the 'service' component, which exactly does that. Vue hasn't.</p>