tanszek:oktatas:iss_t:graphql_integration
                Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| tanszek:oktatas:iss_t:graphql_integration [2025/04/07 16:39] โ created knehez | tanszek:oktatas:iss_t:graphql_integration [2025/04/07 16:49] (current) โ [GraphQL Integration] knehez | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== GraphQL Integration ==== | ==== GraphQL Integration ==== | ||
| - | |||
| - | Comparison of main characteristics with REST API. | ||
| Official documentation: | Official documentation: | ||
| https:// | https:// | ||
| + | |||
| + | Comparison of main characteristics with REST API. | ||
| | | **REST API** | **GraphQL** | | | | **REST API** | **GraphQL** | | ||
| Line 79: | Line 79: | ||
| The GraphQL Playground will be available at the following URL: | The GraphQL Playground will be available at the following URL: | ||
| ๐ http:// | ๐ http:// | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Sample Task: Library System with GraphQL ===== | ||
| + | |||
| + | ==== Task Description ==== | ||
| + | Create a simple GraphQL API to manage data in a library system. The system should store books and authors, and allow adding new books. | ||
| + | |||
| + | ==== Requirements ==== | ||
| + | |||
| + | The GraphQL schema should include the following types: | ||
| + | |||
| + | * **Author**: | ||
| + | * `id` (Int) | ||
| + | * `name` (String) | ||
| + | |||
| + | * **Book**: | ||
| + | * `id` (Int) | ||
| + | * `title` (String) | ||
| + | * `author` (Author) | ||
| + | * `year` (Int) | ||
| + | |||
| + | ==== Features to Implement ==== | ||
| + | |||
| + |   * **Queries: | ||
| + | * List all books (title, author name, year) | ||
| + | * List books by a specific author (searched by name) | ||
| + | |||
| + |   * **Mutations: | ||
| + | * Add a new book with the following fields: title, author ID, year | ||
| + | |||
| + | ==== Example Query ==== | ||
| + | |||
| + | <code javascript> | ||
| + | query { | ||
| + | books { | ||
| + | title | ||
| + | author { | ||
| + | name | ||
| + | } | ||
| + | year | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Example Mutation ==== | ||
| + | |||
| + | <code javascript> | ||
| + | mutation { | ||
| + |   addBook(title: | ||
| + | id | ||
| + | title | ||
| + | author { | ||
| + | name | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Technical Requirements ==== | ||
| + | |||
| + | * Use **FastAPI** and **Strawberry GraphQL** libraries | ||
| + | * Store data using built-in lists (e.g., `authors`, `books`) | ||
| + |   * The GraphQL endpoint should be accessible at `http:// | ||
| + | |||
| + | ==== Bonus ==== | ||
| + | |||
| + | * Implement a new mutation to add an author by name | ||
| + | * Implement a query to list books by a given year | ||
| + | |||
tanszek/oktatas/iss_t/graphql_integration.1744043945.txt.gz ยท Last modified: 2025/04/07 16:39 by knehez
                
                