Skip to content

A quick simple example to show using FastAPI and Jinja templates using WebSockets to update an already served template.

License

Notifications You must be signed in to change notification settings

seapagan/fastapi-jinja-websockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example FastAPI / Websocket application

A quick simple example to show using FastAPI and Jinja templates using WebSockets to update an already served template.

This also uses GraphQL to access the GitHub API, and ties into the 'uvicorn' default logger to keep consistent formatting.

No attempt has ben made to style this app, it's just for my testing and for others to learn. Eventually I will add this a a FastAPI/Jinja based projects showcase.

GitHub Token

You need to add your GitHub token as an environment variable:

export GITHUB_TOKEN=ghp_xxxxxxxxxxxx

Important

You need to have poetry installed as that is used for dependency management

Install the dependencies and enter the virtualenv:

poetry install
poetry shell

Then, run the app using uvicorn:

uvicorn main:app --reload

Open the app in your browser as http://localhost:8000 to see the app. There is a 'Refresh Stats' button to update from the WebSocket

About

A quick simple example to show using FastAPI and Jinja templates using WebSockets to update an already served template.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published