Skip to content

Instantly share code, notes, and snippets.

@2M4U
Created August 2, 2022 14:07
Show Gist options
  • Save 2M4U/07a68de3d825daddc16f4a21527b7fd4 to your computer and use it in GitHub Desktop.
Save 2M4U/07a68de3d825daddc16f4a21527b7fd4 to your computer and use it in GitHub Desktop.
Simple way to get the cosmetic data you need.
const axios = require("axios");
let endpoint = "https://fortnite-api.com/v2/cosmetics/br";
const search = (searchStr) => (item) => item.name === searchStr;
class Cosmetics {
async findCosmetic(input) {
let results = await axios.get(endpoint);
let find = search(input);
var filter = results.data.data.find(find);
return filter;
}
}
module.exports = new Cosmetics();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment