I am trying to consume my api through code I am getting this error object` (“[object Response]”) cannot be serialized as JSON But when I call or use this api through browser I am getting response. here is my code https://codesandbox.io/s/naughty-platform-1xket?file=/pages/index.js I am consuming m…
Tag: node.js
for what “../..” used for? I found it today in this line var express = require(‘../..’);
Hey I was trying to understand node-js routes and found this sentence “var express = require(‘../..’);” I don’t understand the meaning/usage of ‘../..’ here please can someone explain it to me? Answer ‘../..’ is a relative path to index.js file which is si…
“Error: MongooseError: Operation `users.insertOne()` buffering timed out after 10000ms”,
I’m running MongoDB Atlas on node express and I got this error when I tested with postman. This is my .env, I’m guessing the problem might be here too, Kindly help: Answer In my case, I had to go to Atlas, and reset my whitelisted IP to the correct address. Then I restarted my local server and tri…
How to refer a variable in Node.js from another file
I am using node.js to build an app where I have a lot of static text (may change over months) in the code. I want to move the text in a separate file and refer that file data as a variable in the handler file. E.g. The above is original file code. What I want to do is move the
Add functions in other folder, to an object in this folder
I want to create an object that would import functions from another folder and it would look something like this: The functions would be inside of a different folder, however, I want to make some sort of importer in which it would make new classes for each new function/file it finds inside of the folder. some…
How to make summary module that re-exports all the exports of sub-modules for ESM modules?
How do you re-export the exports from multiple files in an ESM module without listing each individual export separately? I have a CommonJS module directory that consists of a number of files that I would like to convert to ESM imports/exports. Currently, I have an index.js file that contains this: This re-exp…
Booking reminder Nodemailer node-cron MongoDB
I am having problem sending a booking reminder email. I use nodemailer and node-cron. It works good. I would like to read date from database and e.g. send email one week before reservation. I have no idea how to do it. My model: I think start time parse to date? How read only this reservation which will be in…
JavaScript,Discord.js, Node.js TypeError: Cannot read property ‘execute’ of undefined
I’m building a discord bot and I want to save information in bdays.json but this error pops up. All other commands are working just fine but I am getting this error: TypeError: Cannot read property ‘execute’ of undefined What should I do? main.js and remeber.js What should I do? Answer You h…
Express Sharp install via Docker issue
I need to use sharp. Its work fine on my workspace but if I deploymeny via docker then I get error. I am implementation all steps. I think sharp is prebuilt when first install. It uses the architecture of my computer(darwin, arm) But when it runs on the docker, although it gets built again, the work talks abo…
How to design a proactive monitoring system?
This is a vague question on design. I have microservice which performs order management. The service orchestrates every order from Placed to Delivered. A lot of things happening in between. Let say these are statuses an order can be. Placed Authorized Shipped Delivered I have an elastic search dashboard which…