Created
August 2, 2022 14:07
-
-
Save 2M4U/07a68de3d825daddc16f4a21527b7fd4 to your computer and use it in GitHub Desktop.
Simple way to get the cosmetic data you need.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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