@supergose/myservice

0.1.4 • Public • Published

MyService Sample project

npm version

A sample project to demonstrate how to bundle a vuejs stand-alone service for wrapping back-end API.

HOW-TO create a standalone Vue Service

With vue-cli >= 3.0 you have create a new vuejs project:

    vue create <my-service>

Delete components and asset folder. Add MyService.js and put the service logic and the bundle.js in order to bundling the service

    import MyService from './MyService'
    export default MyService

Modify the package.json by adding a 'license', a 'main' and a new script named 'bundle':

  "name": "@supergose/myservice",
  "license": "MIT",
  "main": "./dist/myservice.common.js",
  "scripts": {
    "bundle": "vue-cli-service build --target lib --name myservice ./src/bundle.js"
  },

In order to build the bundle launch the new script:

npm run bundle

HOW-TO use the component

In your application include the service in this way

    import MyService from '@supergose/myservice'

and use the component in your template

    MyService.getItems().then(response => {
      ...........
    })

Readme

Keywords

Package Sidebar

Install

npm i @supergose/myservice

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

747 kB

Total Files

18

Last publish

Collaborators

  • supergose