Skip to content

[Feature request] Standard REST routes for @zenstackhq/server #323

@jawadst

Description

@jawadst

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

The REST routes generated are pretty unusual and closer to RPC than REST as the verbs are present in the path instead of the resources. /findMany, /findUnique, /create, etc. are not standard in REST.

Describe the solution you'd like

I'd love more standard REST routes based on collections of resources:

GET /model/findMany -> GET /models
GET /model/findUnique -> GET /models/:id
POST /model/create -> POST /models
PUT /model/update -> PUT /models/:id and PATCH /models/:id
DELETE /model/delete -> DELETE /models/:id`

This also requires defining a collection name (models) from a resource (or model) name (model). That could be an attribute of the model so that it can be configured by the developer.

To make it even more standard, it'd be great to adopt https://jsonapi.org/ for the structure of the HTTP requests and responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions