holidayextras / jsonapi-server

A config driven NodeJS framework implementing json:api and GraphQL
MIT License
488 stars 115 forks source link

Additional Examples (for Handlers) #377

Open aaronfischer opened 6 years ago

aaronfischer commented 6 years ago

Hello!

I was able to get up and running with this and its been in production on a very very small api, just 1 resource, I'd like to expand it but I'm a bit lost at how to do that. The /examples/** are a bit sparse when it comes to /handlers. (Really just: module.exports = new jsonApi.MemoryHandler() which isn't particular helpful) I'd love to see a few examples of how to override/customize search or update with some custom handling.

Is there anyway you could provide some additional examples as a jumping off point?

paparomeo commented 6 years ago

(Apologies for the delay in getting back to you). I'm sure we can help @Aaronfischer (and in the process improve the documentation). Do you have any particular use cases in mind? Do you have a particular data store in mind?

dorothythurston commented 6 years ago

@Aaronfischer I found looking at the examples in the actual memory handler to be some what helpful... for example when i was trying to understand how to return the totalCount in the meta for search results i looked here... https://github.com/holidayextras/jsonapi-server/blob/master/lib/MemoryHandler.js#L29 but I do agree that it is slightly confusing to be new to this library and not have specific custom handlers for the examples instead of having everything tucked away in the memory handler