https://github.com/nareshbhatia/movie-magic-gateway-go
Movie Magic GraphQL Gateway in Go
https://github.com/nareshbhatia/movie-magic-gateway-go
Last synced: 5 months ago
JSON representation
Movie Magic GraphQL Gateway in Go
- Host: GitHub
- URL: https://github.com/nareshbhatia/movie-magic-gateway-go
- Owner: nareshbhatia
- Created: 2024-05-20T01:08:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-21T05:31:42.000Z (about 1 year ago)
- Last Synced: 2024-05-22T02:53:54.757Z (about 1 year ago)
- Language: Go
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Movie Magic GraphQL Gateway in Go
The Movie Magic GraphQL Gateway is based on the [gqlgen](https://gqlgen.com/) library
for building GraphQL servers in Go. It was developed step-by-step starting from
gqlgen [Getting Started](https://gqlgen.com/getting-started/), which builds on top of
a simple Todo schema. I later changed the schema to Movies for the final build.
See the commit history for code progression. The gateway fetches movie data from
[Movie Magic Services](https://github.com/nareshbhatia/movie-magic-services-go),
which exposes a gRPC endpoint.## Prerequisite
This GraphQL gateway fetches data from [Movie Magic Services in Go](https://github.com/nareshbhatia/movie-magic-services-go).
Make sure that that server is running before starting this gateway.## Getting started
1. Make sure you have Go installed.
2. In your shell, run `go run server.go` to start the server.
3. Open GraphiQL at http://localhost:8080
4. Execute the following query:```graphql
# ----- query -----
query ListMovies($input: MoviesRequest!) {
movies(input: $input) {
movies {
id
name
cast {
person {
id
name
}
characters
}
certificate
genres
rank
releaseYear
ratingsSummary {
aggregateRating
}
}
pageInfo {
totalPages
totalItems
page
perPage
hasNextPage
hasPreviousPage
}
}
}# ----- variables -----
{
"input": {
"sort": "SORT_PARAM_RANK_ASC",
"pageSpec": {
"page": 1,
"perPage": 10
}
}
}
```You should see top 10 movies in the result.
## Running gqlgen
```shell
go run github.com/99designs/gqlgen generate
```