Skip to content

Commit f4519ac

Browse files
committed
viewer: Add HTML helper to view nodes
This is PoC of API viewer for development purposes. Signed-off-by: Denys Fedoryshchenko <[email protected]>
1 parent 628a6d6 commit f4519ac

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

api/main.py

+15
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,21 @@ async def stats(user: User = Depends(get_current_superuser)):
714714
return await pubsub.subscription_stats()
715715

716716

717+
@app.get('/viewer')
718+
async def viewer():
719+
"""Serve simple HTML page to view the API /static/viewer.html
720+
Set various no-cache tag we might update it often"""
721+
with open('api/viewer.html', 'r', encoding='utf-8') as file:
722+
# set header to text/html and no-cache stuff
723+
hdr = {
724+
'Content-Type': 'text/html',
725+
'Cache-Control': 'no-cache, no-store, must-revalidate',
726+
'Pragma': 'no-cache',
727+
'Expires': '0'
728+
}
729+
return PlainTextResponse(file.read(), headers=hdr)
730+
731+
717732
versioned_app = VersionedFastAPI(
718733
app,
719734
version_format='{major}',

0 commit comments

Comments
 (0)