Skip to content

Commit

Permalink
Added getting started to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
JorgeRdg committed Apr 17, 2020
1 parent 4b6b4f9 commit 3e0d6a3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ Implemented using:
- Role-based authorization (only admins can access Users API)
- No REST API at all
- Client can get the token from the GraphQL API itself
- Custom error handling to create descriptive error messages
- Custom error handling to create descriptive error messages

### How to use
All the GraphQL API is exposed in `/graphql`. Except for the `getToken` request, all the queries and mutations require a valid token. For all the User-related requests, that token must belong to an ADMIN users.

1. Get an access token (initial user is created with `admin` and `admin` as credentials) by performing a POST request to `/graphql` endpoint with the following GraphQL body:
```graphql
mutation {
getToken(username: "admin", password: "admin")
}
```
2. Run every request with header: `Authorization: Bearer TOKEN`. You can refer to ![the schema](https://github.com/theam/spring-boot-graphql-demo/blob/master/src/main/resources/graphql/mainschema.graphqls) to check the available queries and mutations.

## License
MIT License
Expand Down

0 comments on commit 3e0d6a3

Please sign in to comment.