Skip to content

Tag: node.js

How to store response body in supertest?

I am testing very basic REST api with supertest. I want to save the item id received in response body and assign it to a variable. Using this id i want to make further tests like get-item-by-id or update-item-by-id. No official documentation has covered this so a beginner friendly answer would be very helpful…

Nodejs how to create a `data tree` with array on result

How to fix or redesign results or create a TreeView after mapping the result using nodejs? this is my code, please check below the desired result What I want here is that if the QuestionGroupID is existing it will not create another row but it will create array on optionItems please see the desired result vs …

How do I send a sticker in Discord.js

I can’t figure out how to send a sticker in discord.js. Here is my code (ids removed): And when trying that I get this error: But if I just try stickers: client.guilds.cache.get(‘guild id’).stickers.cache it works but instead sends every sticker in the server Does anyone know what this error…

Can’t persist checkstate in reactjs and nodejs

This would be my first time of doing this and I can’t seem to find a way around it. I would like to persist check box state in react.js and would like this to be done without my MongoDB database. Here are my codes so far: I am fetching list of subscribers from my MongoDB database like this: This display…