-
Install Elixir dependencies:
mix deps.get
-
Create the database, run all the migrations, and load the sample data:
mix ecto.setup
-
Make sure all the tests pass:
mix test -
Fire up the Phoenix endpoint:
mix phx.server
-
Visit
localhost:4000/graphiqlto explore the GraphQL API using the GraphiQL user interface.
query {
places {
id
slug
name
location
description
image
imageThumbnail
pricePerNight
maxGuests
petFriendly
pool
wifi
}
}query {
places(filter: {matching: "lake"}) {
name
location
description
}
}query {
places(filter: {guestCount: 6}) {
name
maxGuests
}
}query {
places(filter: {petFriendly: true, pool: false, wifi: true}) {
name
petFriendly
pool
wifi
}
}query {
places(filter: {
availableBetween: {startDate: "2019-02-01", endDate:"2019-02-10"}
}) {
name
slug
}
}query {
place(id: 8) {
id
name
slug
}
}query {
place(slug: "mountain-chalet") {
id
name
slug
}
}query {
place(slug: "sand-castle") {
id
bookings {
id
startDate
endDate
state
totalPrice
}
}
}query {
place(slug: "sand-castle") {
id
reviews {
id
rating
comment
user {
username
}
}
}
}mutation {
signup(username: "guest", email: "guest@example.com", password: "secret") {
token
user {
id
username
email
}
}
}mutation {
signin(username: "mike", password: "secret") {
token
user {
id
username
email
}
}
}query {
me {
username
email
}
}query {
me {
bookings {
id
startDate
endDate
state
totalPrice
}
}
}mutation {
createBooking(placeId: 1, startDate: "2019-03-01", endDate: "2019-03-05") {
id
startDate
endDate
state
totalPrice
}
}mutation {
cancelBooking(bookingId: 4) {
id
state
}
}subscription {
bookingChange(placeId: 1) {
id
startDate
endDate
totalPrice
state
}
}mutation {
createReview(placeId: 1, comment: "Love!", rating: 5) {
id
rating
comment
insertedAt
user {
username
}
}
}{
__type(name: "Place") {
fields {
name
type {
kind
name
}
}
}
}Credit: https://gist.github.com/franzejr/d0a178286d0e23d3ed50999288806068
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type { ...TypeRef }
defaultValue
}
fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}This app was generated using:
mix phx.new getaways --no-html