ch22: new README.md and minor edits
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import pathlib
|
||||
from pathlib import Path
|
||||
from unicodedata import name
|
||||
|
||||
from fastapi import FastAPI
|
||||
@@ -18,9 +18,8 @@ class CharName(BaseModel): # <2>
|
||||
|
||||
def init(app): # <3>
|
||||
app.state.index = InvertedIndex()
|
||||
static = pathlib.Path(__file__).parent.absolute() / 'static' # <4>
|
||||
with open(static / 'form.html') as fp:
|
||||
app.state.form = fp.read()
|
||||
static = Path(__file__).parent.absolute() / 'static' # <4>
|
||||
app.state.form = (static / 'form.html').read_text()
|
||||
|
||||
init(app) # <5>
|
||||
|
||||
@@ -33,4 +32,4 @@ async def search(q: str): # <7>
|
||||
def form(): # <9>
|
||||
return app.state.form
|
||||
|
||||
# no main funcion # <10>
|
||||
# no main funcion # <10>
|
||||
Reference in New Issue
Block a user