mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
Add note about aliases
This commit is contained in:
parent
05edff8398
commit
d7aac5220e
1 changed files with 21 additions and 1 deletions
22
README.md
22
README.md
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[](https://travis-ci.org/exogen/graphbrainz)
|
[](https://travis-ci.org/exogen/graphbrainz)
|
||||||
[](https://www.npmjs.com/package/graphbrainz)
|
[](https://www.npmjs.com/package/graphbrainz)
|
||||||
[](https://github.com/exogen/graphbrainz/blob/master/LICENSE)
|
[](https://github.com/exogen/graphbrainz/blob/master/LICENSE)
|
||||||
|
|
||||||
An [Express][] server and middleware for querying [MusicBrainz][] using
|
An [Express][] server and middleware for querying [MusicBrainz][] using
|
||||||
[GraphQL][].
|
[GraphQL][].
|
||||||
|
|
@ -285,6 +285,25 @@ schema. The schema was originally designed to be more user-friendly, but in the
|
||||||
end I decided that being compatible with Relay was a worthwhile feature. I
|
end I decided that being compatible with Relay was a worthwhile feature. I
|
||||||
agree, it’s ugly.
|
agree, it’s ugly.
|
||||||
|
|
||||||
|
Don’t forget, though, that you can use [GraphQL aliases][aliases] to rename
|
||||||
|
fields to your liking. For example, the following query renames `edges`, `node`,
|
||||||
|
and `mbid` to `results`, `releaseGroup`, and `id`, respectively:
|
||||||
|
|
||||||
|
```graphql
|
||||||
|
query ChristmasAlbums {
|
||||||
|
search {
|
||||||
|
releaseGroups(query: "Christmas") {
|
||||||
|
results: edges {
|
||||||
|
releaseGroup: node {
|
||||||
|
id: mbid
|
||||||
|
title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
**Why does my query take so long?**
|
**Why does my query take so long?**
|
||||||
|
|
||||||
It’s likely that your query requires multiple round trips to the MusicBrainz
|
It’s likely that your query requires multiple round trips to the MusicBrainz
|
||||||
|
|
@ -314,3 +333,4 @@ See the [GraphQL schema][schema] or the [types][] documentation.
|
||||||
[types]: docs/types.md
|
[types]: docs/types.md
|
||||||
[rate limiting]: https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting
|
[rate limiting]: https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting
|
||||||
[mirror]: https://musicbrainz.org/doc/MusicBrainz_Server/Setup
|
[mirror]: https://musicbrainz.org/doc/MusicBrainz_Server/Setup
|
||||||
|
[aliases]: http://graphql.org/learn/queries/#aliases
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue