Skip to content
Snippets Groups Projects
Commit 0e16ae0e authored by Robert Goldmann's avatar Robert Goldmann
Browse files

fixed documentation for index and /version route

parent 04af49d2
Branches
Tags
No related merge requests found
...@@ -23,21 +23,24 @@ app = FastAPI(title=Constants.APP_NAME, ...@@ -23,21 +23,24 @@ app = FastAPI(title=Constants.APP_NAME,
version=VERSION['name'], version=VERSION['name'],
description='The StorageLeaf API', description='The StorageLeaf API',
servers=[{'url': SETTINGS['api']['url'], 'description': f'{Constants.APP_NAME} API'}]) servers=[{'url': SETTINGS['api']['url'], 'description': f'{Constants.APP_NAME} API'}])
app.include_router(DeviceRouter.router)
app.include_router(SensorRouter.router)
app.include_router(MeasurementRouter.router)
@app.get('/') @app.get('/', include_in_schema=False)
async def root(): async def root():
return RedirectResponse(url='/docs') return RedirectResponse(url='/docs')
@app.get('/version') @app.get('/version',
summary='Gets information about the server version',
tags=['general'])
async def version(): async def version():
return JSONResponse(content=VERSION) return JSONResponse(content=VERSION)
app.include_router(DeviceRouter.router)
app.include_router(SensorRouter.router)
app.include_router(MeasurementRouter.router)
if __name__ == '__main__': if __name__ == '__main__':
serverSettings = SETTINGS['server'] serverSettings = SETTINGS['server']
protocol = 'https' if serverSettings['useSSL'] else 'http' protocol = 'https' if serverSettings['useSSL'] else 'http'
...@@ -56,5 +59,3 @@ if __name__ == '__main__': ...@@ -56,5 +59,3 @@ if __name__ == '__main__':
ssl_certfile=serverSettings['certfile']) ssl_certfile=serverSettings['certfile'])
else: else:
uvicorn.run(app, host=serverSettings['listen'], port=serverSettings['port']) uvicorn.run(app, host=serverSettings['listen'], port=serverSettings['port'])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment