Skip to content

A very simple app to demo fastapi serving basic HTML.

Notifications You must be signed in to change notification settings

Anthlis/fastapi-html-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serve HTML with FastAPI

A very basic sample repo demonstrating how to use FastAPI to serve HTML web apps.

quickstart

# Create a virtual environment in your project folder, and activate it
$ python3 -m venv .env

# clone this repo:
git clone https://github.com/anthlis/fastapi-html-basic.git

# install dependencies into a virtual environment
(.env) $ pip install -r requirements.txt

# start the HTML app
(Note to self, do not 'run' in PyCharm as if it's a Flask app!)
(.env) $ uvicorn app.html:app --reload --port 8080

Navigate to 127.0.0.1:8080/. You should see a 'hello world'.

Then try out 127.0.0.1:8080/form. Enter an integer number and see the result spelled out in words below the box in your browser.

Example: fastapi-html-app

FastAPI auto generates API Swagger documentation too:
Navigate to 127.0.0.1:8080/docs to review and try it out.

fastapi-html-docs

About

A very simple app to demo fastapi serving basic HTML.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published