devour-client icon indicating copy to clipboard operation
devour-client copied to clipboard

could you help me with this case !

Open drupalshift opened this issue 7 years ago • 1 comments

Hi

I'm trying to request this public jsonapi url

const JsonApi = require('devour-client')

const jsonApi = new JsonApi({apiUrl: 'https://live-contentacms.pantheonsite.io/api/'})

jsonApi.define('recipes', {
  title: ''
})

console.log(jsonApi.findAll('recipes'))

I'm getting this error stack an a big object which is not the title of recipes

Promise {
  '': 10,
  _state: undefined,
  _result: undefined,
  _subscribers: [] }
devour error { Error: Request failed with status code 404
    at createError (/home/hamed/Projects/grizzly/contenta_vue_nuxt/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/home/hamed/Projects/grizzly/contenta_vue_nuxt/node_modules/axios/lib/core/settle.js:18:12)
    at IncomingMessage.handleStreamEnd (/home/hamed/Projects/grizzly/contenta_vue_nuxt/node_modules/axios/lib/adapters/http.js:191:11)
    at IncomingMessage.emit (events.js:132:15)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:152:19)

What am i doning wrong here !?

drupalshift avatar Mar 01 '18 12:03 drupalshift

Hey @drupalshift, try defining your resource using the singular recipe and also supplying your api url without the trailing slash.

spiderbites avatar Mar 02 '18 03:03 spiderbites