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
# app/graphql/mutations/create_book.rb | |
module Mutations | |
class CreateBook < GraphQL::Schema::RelayClassicMutation | |
# define return fields (once book is created what can be returned) | |
field :book, Types::BookType, null: false | |
# define arguments required to create a book | |
# you can define a a new Type for inputs so you replace thr following | |
# lines by something like this: |
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
import asyncio | |
loop = asyncio.get_event_loop() | |
async def hello(): | |
await asyncio.sleep(3) | |
print('Hello!') | |
if __name__ == '__main__': | |
loop.run_until_complete(hello()) | |
NewerOlder