Cannot find module 'axios'
Hi everyone!
I am trying to run the following Lambda code, but it returns the error as described in the title. Is this not possible, or am I doing something wrong? I believe that the Axios library is included in Xano.
const axios = require('axios');
const chessUrl = 'https://api.chess.com/pub';const user = input.username;
axios.get(`${chessUrl}/player/${user}/games/archives`) .then(response => Promise.all(response.data.archives.map(url => axios.get(url)))) .then(responses => { const games = responses.flatMap(response => response.data.games); console.log(JSON.stringify(games)); }) .catch(error => { console.error(`Error: ${error.message}`); });
Thanks for checking!
Kind regards,
Robert
Answers
-
I've discovered that there is no need to declare the const axios. With that and some other minor changes, the code is working perfectly fine. No need to answer anymore! :)
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback