$ curl http://localhost:8080\ /api/v1/poems
["this-is-a-photo", "a-question"]
/api/v1/search/poems.json?q=Robert%20Frost
/api/v1/poems?search=Robert%20Frost
$ curl http://localhost:8080\ /api/v1/poems\ ?search=Robert%20Frost ['a-question']
/api/v1/poems?search=x&since_id=y
def listpoems( ... search=None ): if search is not None: ids = _search_poems( db, search ) else: ids = ( id for id in db.poems ) ... paging code as before
search_js = """function( doc ) { if( doc.author ) { if ( doc.author === '%s' ) { emit( doc._id, doc._id ) }}}""" def _search_poems( db, search ): return ( res["value"] for res in db.poems.query( search_js % search ) )
Videos | youtube.com/user/ajbalaam |
---|---|
@andybalaam | |
Blog | artificialworlds.net/blog |
Projects | artificialworlds.net |