If I receive an Array of Objects from a Facebook endpoint, how can I save each Object into my MongoDB? What is the best way to iterate over the returned Array and then store it in my mongoDB? :) The code snippet below shows how I fetch data from the Face ...
Currently, I am in the process of collecting data through REST calls. I have created a function that accesses a "directory" endpoint to retrieve a list of individuals. While I can easily obtain details about their children, I need to make individual AP ...
I'm reaching out here because I have not been able to find clear examples or documentation on this topic. The official Supergent documentation only provides the following information: This method has two optional arguments: number of retries (default 3) ...
Here is the content of my index.js file I am attempting to fetch a response from a sports data API. I can successfully send curl requests to it, but when trying this method, I encounter a 403 forbidden error. var express = require('express'); var config ...
I've encountered an issue where I can't mock files and functions that are utilized in the API call handler. The API call is being simulated with superagent. Below is the test code: // users.itest.js const request = require('superagent&apos ...
The following code is functioning correctly: describe('My App', function() { describe('when logged in', function() { it('should allow registered user to make a thing', function(done) { agent.post('/make-a-thing') .auth('testusername', 'v ...
How can I call a function at the end of a request using Superagent to get the response? request.post('/TextUpload') .send({title:this.state.title1}) .end( function(res){ console.log(res); this.myFunction(); }) I keep receiving the error m ...
Handling errors when using POST with the same user email can be achieved using the following code snippet (utilizing superagent): export function signUpUser(userData) { return async dispatch => { try { const currentUser = await request.pos ...
Recently, I decided to try out a TDD approach using Mocha and SuperAgent. However, I encountered a problem when the res.text from SuperAgent turned out to be undefined. Check out the test below: it('should return 2 when the url is /add/1/1', function(don ...