0
0
Rest APIprogramming~30 mins

Client-server architecture in Rest API - Mini Project: Build & Apply

Choose your learning style9 modes available
Client-server architecture
📖 Scenario: You are building a simple client-server system where the server holds data about books and the client requests this data.This is like a library where the librarian (server) has a list of books, and the visitor (client) asks for information about the books.
🎯 Goal: Create a basic server that stores book data and a client that requests and displays this data.
📋 What You'll Learn
Create a server with a dictionary of books and their authors
Add a configuration variable for the API endpoint
Write a function to get book data from the server
Print the book data received by the client
💡 Why This Matters
🌍 Real World
Client-server architecture is the foundation of many web and mobile applications where clients request data and servers respond.
💼 Career
Understanding client-server basics is essential for roles like backend developer, frontend developer, and full-stack engineer.
Progress0 / 4 steps
1
DATA SETUP: Create the server data
Create a dictionary called books with these exact entries: '1984': 'George Orwell', 'To Kill a Mockingbird': 'Harper Lee', 'The Great Gatsby': 'F. Scott Fitzgerald'
Rest API
Need a hint?

Use curly braces to create a dictionary with the exact book titles as keys and authors as values.

2
CONFIGURATION: Define the API endpoint
Create a variable called api_endpoint and set it to the string '/get_books'
Rest API
Need a hint?

Set api_endpoint exactly to the string '/get_books'.

3
CORE LOGIC: Write a function to get books from the server
Define a function called get_books that takes no parameters and returns the books dictionary
Rest API
Need a hint?

Write a function named get_books that returns the books dictionary.

4
OUTPUT: Print the books data from the client
Call the get_books() function and print the returned dictionary
Rest API
Need a hint?

Use print(get_books()) to show the books dictionary.