 # url handlers

import re, time, json, logging, hashlib, base64, asyncio

from coroweb import get, post

from models import User, Comment, Blog, next_id

@get('/')
async def index(request):

    # users = await User.findAll()
    summary = 'XXXXXXXXX啦啦啦啦啦啦啦'
    blogs = [
        Blog(id='1', name='AAAAA', summary=summary, created_at=time.time() - 1200),
        Blog(id='2', name='BBBBB', summary=summary, created_at=time.time() - 3600),
        Blog(id='3', name='CCCCC', summary=summary, created_at=time.time() - 7200)
    ]
    return {
        '__template__': 'blogs.html',
        'blogs': blogs
    }