prismake / typegql

Create GraphQL schema with TypeScript classes.
https://prismake.github.io/typegql/
MIT License
424 stars 21 forks source link

Add JWT example with @Guard decorator #8

Open pie6k opened 6 years ago

lorefnon commented 6 years ago

I have been working on an example application for personal evalation. It is very early prototype but features client-server JWT auth.

I plan to integrate hierarchical role based authorisation in near future.

pie6k commented 6 years ago

If you'd like to extract it from your app and create PR with example, that would be so awesome @lorefnon :)

lorefnon commented 6 years ago

Sure, will do.

I just realized that @Guard no longer exists in master. I will update my example to use @Before and create a PR shortly.

pie6k commented 6 years ago

Right. I've removed it as @Guard was simply not needed abstraction. It was simple function in form of

function Guard(options) {
  return Before(otherOptions)
}

as I think it's good approach to keep graphql more like library than framework, I've decided such Guard is bad abstraction.