moon-axios

0.0.4 • Public • Published

moon-axios

A small wrapper for integrating axios to Moon.js

How to install:

CommonJS:

npm install --save axios moon-axios

And in your entry file:

import Moon from 'moon'
import axios from 'axios'
import MoonAxios from 'moon-axios'

Moon.use(MoonAxios, axios)

Script:

Just add 3 scripts in order: moon, axios and moon-axios to your document.

<script src="https://unpkg.com/moon-axios"></script>

Usage:

This wrapper bind axios to Moon or this if you're using single file component.

You can axios like this:

Moon.axios.get(api).then((response) => {
  console.log(response.data)
})

this.axios.get(api).then((response) => {
  console.log(response.data)
})

this.$http.get(api).then((response) => {
  console.log(response.data)
})

License

Copyright to Daksh Miglani | Licensed to MIT.

Package Sidebar

Install

npm i moon-axios

Weekly Downloads

0

Version

0.0.4

License

MIT

Last publish

Collaborators

  • dakshmiglani