I am building ecommerce website using MERN stack. And I am getting error while testing using Postman. backend/controllers/user.js backend/models/Order.js backend/models/User.js backend/routes/user.js Error:- TypeError: Order.find is not a function at exports.userPurchaseList (C:UsersRahulMernBootcampprojbackendcontrollersuser.js:47:9) TESTING this route using POSTMAN. Answer You have exported an object so in your backend/controllers/user.js you could import it like so from destructuring from the object then the rest
Tag: postman
postman: You need to enable JavaScript to run this app
I’ve got a new API from the backend team in a new project, when I call the api it returns “you need to enable java…”, whereas I had used Postman for another project before… is it related to api, server or something else? Answer I spent some times pondering on this trepidation.. and then suddenly i realized what was going
Postman – I want to check a value to be inside an array
I am writing a postman test in JavaScript to assert the scenario below. I have an id 1111 and the response returns an array of ids. I want to write a test to match 1111 to be in one of the ids in the array. I have tried to use the include function i.e. Any suggest. Answer You’re trying to
Get redirected URL from Postman
I’m currently migrating my old website to a new one and I have just created some url redirect rules to redirect old links to their pages on the new website. In order to test these redirect rules I’m using Postman but I can’t find any way of getting the redirected url from Postman’s scripts documentation. REDIRECTED_URL is the url after
Why can’t I add a simple reusable function to Postman?
In Postman, I’m trying to achieve the following: In a collection: Create a utility object containing reusable functions Store that utility object in a global variable for later use in request test scripts. In a request: Pull the utility object code out of the global variables. Eval the code and store the resulting utility object instance in a local variable.
How to verify if a node in response body has unique value with postman?
The following is the response body of an API: In Postman Tests, how to verify if exercise_num node in the response body above is unique? Answer Filter out unique exercise_num values and compare the length of the actual array and unique value array. Where you can use Array#reduce method for filtering unique values.
How to compare a string to a date in postman test?
Suppose a API request fetches a users id, email address and birthday. Sample API Request below: For the above request, the following is the response: Now, what will be the test in postman to make sure that all the returned values under birthday node is greater than 1988-18-01? I have tried the following: But postman says: “Check birthday greater than