RunKit + npm: @rondinif/phytojs

node v10.24.1
version: 0.1.0
endpointsharetweet
exports.endpoint = function(request, response) { const phytojs = require("@rondinif/phytojs/umd/phyto"); const fetch = require('isomorphic-fetch'); const phyto = new phytojs.Phyto(fetch); // , config, log); const vernacular = 'rosmarino'; phyto.resolvedPlantsByName(vernacular).then(async res => { response.end(JSON.stringify(res)); }).catch(error => { console.error(`generic error: ${error} \n searching for ${vernacular || 'nothing'}`) }); }
Created from: https://npm.runkit.com/@rondinif/phytojs
Loading…

2 comments

  • posted 5 years ago by rondinif
    GET https://phytojs-rosmarino-qayeaa611imm.runkit.sh
  • posted 5 years ago by rondinif
    $ curl -s https://untitled-qayeaa611imm.runkit.sh | jq { "name": "rosmarino", "plants": [ { "wdEntityId": "Q122679", "wdPageId": 124921, "wdSnippet": "species of plant, rosemary", "scientificName": "Rosmarinus officinalis", "taxonRankId": "http://www.wikidata.org/entity/Q7432", "taxonRankLabel": "species", "specieArticle": "https://species.wikimedia.org/wiki/Rosmarinus_officinalis", "image": "http://commons.wikimedia.org/wiki/Special:FilePath/Rosemary%20bush.jpg" } ] }

sign in to comment