How do I make an API request through Node.JS?

How do I make an API request through Node.JS?

In Zoho creator, I created a function that uses nodeJS. In the function, I'm making an API call to an outside URL using a fetch request. The problem is that whenever I run it, it says that "fetch" is not a function at module.exports. I've also tried it with an axios request but that doesn't work either. I see that there's a node_modules folder so I'm trying to put the axios module inside but it only allows me to upload files and not entire folders. How do I go about making an API call in NodeJS (in Zoho creator)?

  1. module.exports = async function (context, basicIO )
  2. {
  3. const baseURL = basicIO.getParameter("URL");
  4. axios(baseURL)
  5.     .then(resp => resp.json())
  6.     .then(data => 
  7.     basicIO.write(data)
  8.     );
  9. }

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now