Modify the Resolver
Learn how to modify the resolver in the GraphQL application.
Implement the resolver
Inside the schema.resolvers.go file, we implement all the resolvers.
Register
First, we implement the resolver for the registration.
Below is an explanation of the code above:
-
In line 3, the
r.userService.Register(input)function performs user registration. This function returns the JWT token. -
In line 11, if the registration succeeds, the JWT token is returned.
Login
We implement the resolver for the login.
Below is an explanation of the code above:
-
In line 3, the
r.userService.Login(input)function performs a login for the registered user. -
In line 11, if the login is successful, the JWT token is returned.
Create a new blog
We implement the resolver for creating a new blog.
Below is an explanation of the code above: ...