Nest: JSON:API implementation

Created on 7 Dec 2019  路  4Comments  路  Source: nestjs/nest

Feature Request

Is your feature request related to a problem? Please describe.

I can't use JSON:API format with Nest.js (Request URLs handling, ex.: /user?include=image&sort=-name).

Describe the solution you'd like

Implementation, documentation and example how to handle JSON:API format requests with Nest.js.

What is the motivation / use case for changing the behavior?

JSON:API is highly growing HTTP(AJAX) standard. This is one of the major reasons why Nest.js is not used for some projects. It would be great if Nest.js would have some kind of handler for this, because it is a great framework and it would be a shame not to use it just because it is not supporting JSON:API format requests.

needs triage type

Most helpful comment

I think a first step would be serializing data to JSON:API () https://jsonapi.org/format/

https://github.com/SeyZ/jsonapi-serializer#readme
https://docs.nestjs.com/techniques/serialization

Allowing requests via includes would be a second step that is optional: https://jsonapi.org/format/#fetching-includes

I think this should be implemented as an optional module. Just like GraphQL https://docs.nestjs.com/graphql/quick-start

All 4 comments

I can't use JSON:API format with Nest.js

There is no reason why you couldn't use JSON:API with Nest. Nest provides an architecture and it's up to you what you'll build on top of that.

Please, use our Discord channel (support) for such questions next time. We are using GitHub to track bugs, feature requests, and potential improvements.

I think that what it say, is that it would be nice to be able to generate json-api compatible api by just installing a special package. Something like @nestjs-jsonapi that when installed transform the output of the nestjs REST implementation. The same idea behind the proposing of express or fastify implementation

It would be must easier than take a implementation and integrate it manually with nest.

@scandinave have you had a look at nestjsx/crud?

I think a first step would be serializing data to JSON:API () https://jsonapi.org/format/

https://github.com/SeyZ/jsonapi-serializer#readme
https://docs.nestjs.com/techniques/serialization

Allowing requests via includes would be a second step that is optional: https://jsonapi.org/format/#fetching-includes

I think this should be implemented as an optional module. Just like GraphQL https://docs.nestjs.com/graphql/quick-start

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rlesniak picture rlesniak  路  3Comments

cojack picture cojack  路  3Comments

2233322 picture 2233322  路  3Comments

JulianBiermann picture JulianBiermann  路  3Comments

FranciZ picture FranciZ  路  3Comments