Skip to content
Advertisement

Tag: node.js

Why I can get and api data with fetch and not with axios?

I got this test code: I’m trying to understand why readWithFetch works fine and axios gets connection refused. It’s a simple basic auth… nothing fancy. I’ve tried all these readWithAxios versions: version 1 version 2 version 3 version 4 What is the correct way to write readWithAxios ? Answer You have a triple slash in https:///geolite in the Axios versions.

mongodb .find elements in an array

I have an array that dynamically holds document id’s, in which I need to query another collcetion in mongo to see if the id’s match. I have this code: however, doing “id”: { $in: array_of_docs_bought } doesn’t iterate through the array, so it returns nothing, but when I do this: let documents = await database.collection(‘documents’).find({ “id”: { $in: [ ‘g81h8’,

generate one of the mutiple possibles anagrams of a string

I’m kind of new to JavaSCript and I want to ask wow can I make a random anagram generator, without a list of all possible anagrams (because that’s not optimized) Example: input: “abc” output: get the input, split it ([“a”, “b”, “c”]), randomize the split and join them ([“cba”]) This is for a command for my bot in Discord. I’ve

Nest JS Table is not creating. Written entities

Team, I have followed Nest.js and TypeORM documentations. Somehow tables are not generating in PostgreSQL. The database is connected successfully. Nest Server running without error. Issue: The table is not generating. src/tag/tag.entity.ts src/app.module.ts .local.env Please help me generate Postgres tables. Framework – Nest JS Database – PostgreSQL Answer Your username is mediumclone but the database you’re connecting to is postgres,

How can i create a directory using Node.js?

how can i write the name and the path of my directory that i will to create in the same node command, like this and remove the path in my script > node ./stack/create.js ./path/folderName i´m trying to create a directory with this script but i want to remove const path in my script and set the path and name

Advertisement