Last active
July 17, 2017 09:02
-
-
Save pmk1c/90523224e8fdc6da78ac1246a86a1deb to your computer and use it in GitHub Desktop.
RestQL - create function in PostController with GraphQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Restql.Web.PostController do | |
# ... | |
def create(conn, %{"post" => post_params}) do | |
graphql conn, """ | |
mutation CreatePost($title: String!, $body: String!) { | |
post(title: $title, body: $body) { | |
id | |
} | |
} | |
""", post_params | |
end | |
# ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment