Service that allows to search gifs from two pages by phrase.
You must install nodejs on your computer and get two api keys from services: giphy, pixabay.
Steps:
-
npm install
-
npm run compile
-
Create file 'api-keys.json' contains
{}
or api keys like in develop process. -
If your 'api-keys.json' has empty object you must run
npm run server -- --pixabayApiKey=xxxxxxx --giphyApiKey=xxxxxxxx
but if you have api keys in this file you can runnpm run server
.
Steps:
-
npm install
-
You must create file 'api-keys.json' in main project catalog that contains
{
"pixabayApiKey": "xxxxx",
"giphyApiKey": "xxxxx",
}
npm start
-
You must add config value API key of new service.
-
You must pass the value of API key to variable that will be used in the URL.
example:
const giphyApiKey = nconf.get('giphyApiKey');
- You must add new object to dataSources array. Data source object model:
{
"url": "url to search endpoint with place at the end to paste phrase",
"propertyNameOfResultsArray": "name of property with results array",
"resultMappingFunc": "function that mapping result to format { url, height }",
},
example:
{
url: `https://api.giphy.com/v1/gifs/search?api_key=${giphyApiKey}&limit=10&q=`,
propertyNameOfResultsArray: 'data',
resultMappingFunc: result => {
const { url, height } = result.images.downsized_medium;
return { url, height: +height };
},
},