-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
38 lines (29 loc) · 836 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from aiohttp import web
from aiohttp_swagger import setup_swagger
from app import (
cells,
)
from s2sphere import (
Cell,
LatLng,
)
async def index(req):
"""
---
description: This end-point produces a simple example webpage.
produces:
- text/html
responses:
"200":
description: successful operation. Return "welcome" text
"""
with open('views/index.html') as f:
return web.Response(text=f.read(), content_type='text/html')
if __name__ == '__main__':
app = web.Application()
app.router.add_get('/', index)
app.router.add_post('/cell', cells.from_latlng)
app.router.add_get('/cell/{id}', cells.cellid)
app.router.add_get('/cells/region', cells.from_rect)
setup_swagger(app, swagger_url='/api/v0/doc')
web.run_app(app, port=8081)