axios-eve

A axios api for postpress

Usage no npm install needed!

<script type="module">
  import axiosEve from 'https://cdn.skypack.dev/axios-eve';
</script>

README

axios-eve

Promise based HTTP client for api build up on eve-framework

Installing

Using npm:

$ npm install axios-eve

Example


// declare endpoits
let config =  [
        {
            "url": "area",
            "type": "eve",
            "methods": ["GET"]
        },
        {
            "url": "questions",
            "type": "eve",
            "methods": ["GET"]
        },
        {
            "url": "user",
            "type": "eve",
            "methods": ["GET"]
        },
        {
            "url": "user/admin",
            "type": "eve",
            "methods": ["POST"]
        },
        {
            "url": "area/{name}",
            "type": "eve",
            "methods": ["GET"] 
        }
    ]

let api = new Api({
  urls: config,
  baseURL: 'http://localhost:8000',
  headers: {
      'Cache-Control': 'no-cache'
  },
  timeout: 1500
})

// return areas
api.getArea({})

// return page 2 
api.getQuestions({page: 2})

// sort by name
api.getUser({sort: {name: 1}})