CSCI 338: Fall 2025

Software Engineering

CSCI 338: Fall 2025

Assignments > Lab 7: AsyncIO + MVC

Due on Tue, 10/28 @ 11:59PM. 6 Points.

Slides for today’s Lab

Set Up

Get the latest code from https://github.com/<your_github_handle>/class-exercises-fall2025 by syncing changes to your GitHub repo (click the “Sync Fork” button).

Then, on your local machine, make sure that all previous work is committed. Then:

git checkout main
git pull
git checkout -b lab07-b

Run the Application

poetry install
cd app
poetry run uvicorn server:app --reload

Visit http://127.0.0.1:8000?place_name=Asheville to test the app.

MVC Architecture

This lab uses MVC (Model-View-Controller) pattern with FastAPI, AsyncIO, and Jinja templates:

The app uses asyncio.gather() to fetch multiple API responses concurrently, making it much faster than sequential requests.

Tasks

1. Model Task

Add a get_dog_image() function in models.py that fetches from “https://dog.ceo/api/breeds/image/random”

2. Controller Task

Modify both / and /api endpoints in server.py to include dog_data from your new function

3. View Task

Add an <img> element in templates/index.html to display the dog image. Use the double curly braces to output the correct value from the data.

Extra Tasks

Submission

Complete all three tasks, then:

  1. Commit and push your lab07-b branch
  2. Create a pull request to main
  3. Submit the PR link in Moodle

Resources: