File size: 676 Bytes
f42ec01
5262393
a9ea03f
5262393
b2a5e86
5760b44
ca2592c
5760b44
5262393
ca2592c
5262393
5760b44
5262393
 
a9ea03f
a5fed35
a9ea03f
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import uvicorn
from fastapi import FastAPI
from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
from os.path import realpath

from commafixer.routers import baseline, fixer

app = FastAPI()
app.include_router(fixer.router, prefix='/fix-commas')
app.include_router(baseline.router, prefix='/baseline')

# Without the realpath hack tests fail
app.mount("/", StaticFiles(directory=realpath(f'{realpath(__file__)}/../static'), html=True), name="static")


@app.get('/')
async def index() -> FileResponse:
    return FileResponse(path="static/index.html", media_type="text/html")


if __name__ == '__main__':
    uvicorn.run("app:app", port=8000)