const { getSprite } = require('pokemon-images');
const toPokemonGif = URL => getSprite((URL.match(/\?(.*)/) || [, "pikachu"])[1]);
exports.endpoint = (request, response) =>
response
.setHeader("content-type", "text/html; charset=UTF-8")
.end(`<img src = "${toPokemonGif(request.url)}">`);