项目作者: a-mt

项目描述 :
FCC (Legacy) Back End: Image Search Abstraction Layer
高级语言: JavaScript
项目地址: git://github.com/a-mt/fcc-image-search.git
创建时间: 2017-03-06T00:24:01Z
项目社区:https://github.com/a-mt/fcc-image-search

开源协议:

下载


Image Search Abstraction Layer

User Stories :

  • I can get the image URLs, alt text and page urls for a set of images relating to a given search string

    1. /api/imagesearch/lolcats%20funny
    2. `
    1. [{
    2. "url": "https://i.imgur.com/qu6Qhh6g.jpg",
    3. "snippet": "Could these cat assembly instructions be any more confusing ...",
    4. "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ93C--aIWfWTzemVB4CTik8s9UE451qh9ksvfXOyBeMq--W72AywJNNA&s",
    5. "context": "https://imgur.com/gallery/could-these-cat-assembly-instructions-be-any-more-confusing-3Mjl31l"
    6. },
    7. {
    8. "url": "https://i.imgur.com/3HiHnWs.jpeg",
    9. "snippet": "The LOLcats are here again. - lolcats post - Imgur",
    10. "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQBzVLe3xmto3DyUENL10jpsTGRcep6-Rr-zjSFd7ucbX07kORvTvFCJQ&s",
    11. "context": "https://imgur.com/gallery/lolcats-are-here-again-emyWO"
    12. },
    13. {
    14. "url": "https://i.imgur.com/N1cwrGh.jpeg",
    15. "snippet": "lolcats Circa 2006 Dump part 5 - outdatedmeme post - Imgur",
    16. "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTKdsdpXgNdyGMQg0xEfF5zT4ygNQApGqLR5YHd_CcAB4j_0hvqFsPQ8xc&s",
    17. "context": "https://imgur.com/gallery/lolcats-circa-2006-dump-part-5-7Vc4Okl"
    18. }
    19. ]
  • I can paginate through the responses by adding a ?offset=2 parameter to the URL.

    1. /api/imagesearch/lolcats%20funny?offset=10
  • I can get a list of the most recently submitted search strings

    1. /api/latest/imagesearch/
    1. [{
    2. "_id": "666725bfb6b5d5c537f5cb45",
    3. "term": "lolcats funny",
    4. "when": "2024-06-10T16:11:43.858Z"
    5. },
    6. {
    7. "_id": "666725b9b6b5d5c537f5cb44",
    8. "term": "lolcats funny",
    9. "when": "2024-06-10T16:11:37.718Z"
    10. }
    11. ]

Install

Deploy on Netlify

  1. netlify init
  2. netlify env:set MONGOLAB_URI "$MONGOLAB_URI"
  3. netlify env:set CSE_API_KEY "$CSE_API_KEY"
  4. netlify deploy
  5. netlify deploy --prod