widdydev / serverless-graphql-appsync-rds

Example implementation of a GraphQL endpoint with AWS AppSync & RDS using the serverless framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improvement of field parsing

sebastianwahn opened this issue · comments

I adapted your work to my repository and it works like a charm so far. Although, for sake of simplicity I'd recommend using field names like "post_create", "post_update", "comment_create", ... etc.

This has the simple effect that your lambda handler can parse the field and split it by "_" instead of having a lower camel casing (which is more difficult to split).

With this, you can split for example "post_create" to "post" and "create" which will probably reduce the size of your big switch case and could introduce some structuring for each resource (post, comment, ...)

Thank you for the feedback, really appreciated!
Splitting by underscores is a very good approach! I will definitely use this in my project.