Skip to content

GemCityTECH/new-to-tech-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCT-Rest

A sample repository to support New To Tech sessions exploring REST for Gem City Tech.

See the backing presentation here.

How to run

Prerequisites

You must have Python 3.12 and Poetry installed.

Execution

Ensuring that you have Poetry available in your terminal, run

poetry shell

to use Poetry's virtual environment, and then

poetry install

to install FastAPI and the other dependencies. Then, change directory to the api folder:

cd api

and run the service using Uvicorn:

uvicorn main:app --reload

Navigate to http://127.0.0.1:8000/docs to see the built-in Swagger API documentation.

Suggested Exercises

Starting Out

  • Add a 'genre' field to Book. Make sure that you can see this field using GET /books and update it using PUT /books/{id}.

  • Add an endpoint that lets you GET a book by author and/or publication year.

  • Add a GET endpoint that shows the average rating across all books.

  • Add support for multiple ratings - and reviewers - per book, and to view both individual reviews and the average review score for a book.

Moderate

  • Share your solutions to one of the above exercises using a GitHub Pull Request.

  • Return the summary and ratings for a book using Goodreads' API.

  • Return author biographies using Wikipedia's API.

  • Rework this book-based sample app into a different domain: customer tracking, RPG character creator, pizza store, etc.

Complex

  • Add an ORM tool such as SQLAlchemy and use it to persist data between runs.

  • Migrate the app's API to GraphQL.

  • Dockerize the app.

  • Host/deploy the app publicly.

  • Build a small JS UI in front of the API.

Additional Files

If you use Insomnia, Insomnia REST call collection.json can be imported to get you started making calls against this API.

About

Example repo to support upcoming New To Tech session

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages