Questions tagged [node.js]

Node.js is an event-based, non-blocking, asynchronous I/O runtime that uses Google's V8 JavaScript engine and libuv library. It is used for developing applications that make heavy use of the ability to run JavaScript both on the client, as well as on server side and therefore benefit from the re-usability of code and the lack of context switching.

Filter by
Sorted by
Tagged with
0votes
0answers
10views

Two keys in one object seem to be the same?

I'm using a function to convert csv to array. When I use object.name to refer to the attribute, it returns 'undefined', but when I use 'console.log(object)' that attribute is there. Then I tried to ...
user avatar
  • 1
0votes
0answers
3views

How to use GitHub SSH key for private/public repositories in a Nodejs for (clone, pull, push, and commit)

I tried using Nodegit in the same method, but I got an error message saying "Clone.clone, stack: Error: Method clone has caused an error." or "Github authentitation failed."
user avatar
0votes
0answers
3views

How to pass headers in nginx for websockets?

I'm trying to proxy pass a websocket with nginx. My nginx.conf looks like this: server{ server_name example.com; listen 80; location /socket.io/ { proxy_http_version 1.1; ...
user avatar
  • 1
0votes
0answers
6views

has been blocked by CORS policy: Request header field contend-type is not allowed by Access-Control-Allow-Headers

I learn NodeJS and REACT and I built the frontend and the backend. for now, I want to connect the front to the back. so, I add those lines of code in my app.js of the backend: app.use((req, res, next) ...
user avatar
0votes
0answers
2views

Slack OAuth HTTP Post Request returns "undefined" access token

I'm using the following code in a simple slash command app to handle OAuth for public distribution of my app: const express = require("express"); const bodyParser = require("body-parser&...
user avatar
0votes
0answers
12views

user existence check not working - discord.js

I'm trying to write a discord bot. Now there is one command in which another user is selected. So far, all commands work except for one, checking for the existence of a user. That's how I do it if (!...
user avatar
  • 35
0votes
0answers
9views

npm ERR! gyp info , npm ERR! gyp ERR! find VS

npm ERR! code 1 npm ERR! path C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle\node_modules\ganache\node_modules\keccak npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /...
user avatar
0votes
0answers
5views

How to get csv records as objects in fast-csv, with properties in their original types rather than string?

Currently I am able to parse data as objects, But the object looks like: { CallTime: '0', Color_MachineState: 'ManualStop', StartDate: '2021/1/7 19:03', MachineName: 'CDK10' } Now, What I want is, ...
user avatar
0votes
0answers
10views

Is it possible for Storybook to run of a separate package.json than the main build?

I think it's fairly common to have miss-matched package dependancies between you main build and storybook which is a pain and always results in downgrading packages. Which isn't a good solution as you ...
user avatar
0votes
0answers
7views

extract atrributes of all active directory users

I want to extract certain attributes (such as email, phone, etc.) of an active directory users using Node JS. According to this documentation, I was able to extract the attributes of a certain user ...
user avatar
  • 613
0votes
0answers
13views

Limits of parallel async axios calls in Express+NodeJS

I'm making a NodeJS express API which acts simply as a forwarder to other third party APIs. Example: A call to /user API in my express app will forward it to some other public API after applying some ...
user avatar
0votes
0answers
10views

How to update multiple documents with different values in mongoose

I want to execute the following two updates in single update query. // delete the user with (requestID) from friends await User.updateOne({ _id: id, }, { $pull: { friends: requestID } }) // ...
user avatar
0votes
0answers
19views

How to assign a value to a key within an array?

I am trying to add the about, link values into the description array defined in the schema and then use the .save() function to save it to the database. Any help would be appreciated. Thank You. ...
user avatar
0votes
0answers
8views

Best practices for real time communication between frontend & backend in 2022

Context I am building a real time IoT platform. We ingest hundreds of thousands, soon millions, of events everyday that mutate our databases. We have 1000s of IoT devices and each IoT device emits ...
user avatar
  • 2,607
0votes
0answers
9views

I'm successfully connected to server and to database, but I tried testing POST Request with Postman but all I get is {} with status 400 (Bad request)

Here is my user schema: const userSchema = new mongoose.Schema({ username:{ type: String, required: true, unique: true }, email:{ type: String, required: true, unique: true }, ...
user avatar
0votes
0answers
7views

Attaching different Nodejs API end-points to a button in a simple HTML page?

I am trying to call an API end-point localhost:8000/api/v1/book/confirm on the button in the HTML web page, how can this be done? this will be a post method to the MongoDB database. so what I want to ...
user avatar
  • 31
3votes
1answer
23views

'Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'writeFile')' error while trying to write to a file with REACT

I am trying to write to a file with a button click inside my React application and it gives an error. My current code looks like this. import {fs} from "fs" function App() { async function ...
user avatar
0votes
1answer
8views

unable to load from yargs in nodejs

unable to load from yargs.argv. i am using npm latest version. its showing undefined in terminal when i use yargs.argv unable to load from yargs.argv. i am using npm latest version. its showing ...
user avatar
0votes
1answer
7views

How to access a MongoDB database from a different Server

In a microservice architecture, I have 2 separate services with different mongoDb databases. Teacher-Service and Student-service. Now I'm trying to create a login function, once a user submits an ...
user avatar
1vote
0answers
7views

How to insert id using typeorm mongodb

I am trying to insert the id of a record using typeorm mongodb. I have created an Entity class for User, then I created a service for saving user into the database. @Entity() export class User { @...
user avatar
1vote
2answers
18views

Does Webpack include all dependent node modules along with the created bundle for production?

We all know that when we hit the npm run build, the react scripts uses the Webpack and creates a bundle going through all the dependency graph (follow the imports) and creates a bundle.js and places ...
user avatar
1vote
0answers
10views

Can you help me in extracting data from a listObjectsInBucket function from aws-sdk using nodejs?

I am not sure how to extract the data out of this function below. It is a function from aws-sdk I can see the console log, but I am not able to save it in a variable.. even if its a global variable....
user avatar
0votes
0answers
12views

npx create-next-app command not working ENOENT error

It is showing this error, i'm using npx still it is showing using yarn, npx is working fine when i'm using it for react app It should provide me the next app starter
user avatar
0votes
0answers
6views

Make custom terminal commands with parameters in nodejs

I wish I could create my custom cmd command for example "log", that could execute a .js file for example app.js present in my project folder whenever called. I also want to pass parameters ...
user avatar
1vote
0answers
19views

Client side Javascript fetch() POST not sending empty objects to server endpoint

I need some help with fetch() POST. The server-side works with Postman, but when I execute a fetch from JavaScript the server endpoint receives an empty object as the req.body. I have looked at many ...
user avatar
0votes
0answers
10views

Cross Cutting Concerns / Invariants / Domain Logic Query

Im finding this a tough question to phase accurately but here goes. Suppose I have a request handler on my server that looks something like: async function finishGame(userId: string, gameId: string) { ...
user avatar
  • 1,310
0votes
0answers
8views

Always getting 'Server is not responding!!' error in Node express

While calling the service layer from the controller, the response is not waiting for the result in the controller. So, I am not getting correct response (return value) from the service layer. ...
user avatar
-2votes
0answers
7views

socket.io connection established then i send message Connection closed

node.js express applications connection established then i send message Connection closed os - centos 7 panel - cpanel server - Apache
user avatar
0votes
0answers
8views

Screen gets stuck at this follow command when i tried to create a react app. only package.json file gets created

Windows PowerShell Copyright (C) 2015 Microsoft Corporation. All rights reserved. PS C:\React Course> npx create-react-app my-app Creating a new React app in C:\React Course\my-app. Installing ...
user avatar
0votes
0answers
19views

why aws is returning server ip address not the device ip address?

I am trying to get server ip address of my device but my aws is returning server ip address . I am using following code . return new Promise((resolve) => { http.get({ 'host': 'api64.ipify.org', '...
user avatar
0votes
0answers
6views

node- Use puppeteer to test a website made with react

Is possible with puppeteer to test a website that will assign classes to the DOM elements dynamically? the site is made with react and at the moment I'm unable to create a working puppeteer script ...
user avatar
  • 15
0votes
1answer
14views

nodejs program does not find server.js file when run server.js file and when I ran it directly, it make me a spelling mistake?

I am making a Nodejs file following this tutorial https://www.bezkoder.com/react-node-express-mysql/ and here is my code https://github.com/anhquanjp/problemreact1 My problem is, when I ran the code ...
user avatar
0votes
0answers
5views

Nodejs Create BinaryRow Data Structure with Raw Data with JSON string saved in Redis Client?

I am reading off from a Redis cache which has the user data with 'JSON string', However in the Nodejs application, it sends the data as in the below format, I want to create the exact same structure ...
user avatar
  • 5,909
0votes
0answers
14views

Best method to keep track of a users progression through reading sections of text

Similar to zyBooks if you are familiar with it, I want to track the sections the user has read through and checked completed with a button. However, conceptually I am having trouble thinking of what ...
user avatar
0votes
0answers
13views

How to securely escape strings such as EJS tags?

I'm a little bit confused on how to secure an app that uses ejs. For example if I upload a file and I name it "<% function() { do something } %>" and that gets put into my ejs file ...
user avatar
0votes
0answers
13views

Send a CORS request to Localhost from an electron application

I'm working on a project that involves an application built with Electron that interfaces with an express server, running on Localhost or the home network. Problem right now is, I'm having trouble ...
user avatar
0votes
1answer
34views

Is there a better way to define these funtions?

There has to be a better way of doing this. I feel like I'm repeating myself. Can anyone help? I'm a bit new to this. Is there some way that these different data functions and variables into a class ...
user avatar
-3votes
0answers
13views

How to print values in an array? [duplicate]

So I turned my MySQL database into a string which is being sent to the subpage "/customers" but... I need to sort the data. Currently, I have a script that shows each object's value using ...
user avatar
  • 1
-1votes
1answer
9views

How to run node.js script from systemd service

I have a node.js script in my directory on my raspberry pi /home/pi/my/app/here/app.js When I navigate using cd my/app/here and run node app.js my script executes without any problems. However, when I ...
user avatar
  • 5,084
1vote
0answers
6views

How to use Node.js' TLSSocket to connect (and reconnect) to a server?

I have a toy IRC bot that I've been hacking on, and it has the ability to connect to multiple servers at once, both unencrypted and over TLS. Originally my connection code looked like this: ...
user avatar
0votes
0answers
15views

What is the correct approach to print a PDF directly to the printer?

How to use Node.js to print directly to the printer? For example, send a PDF file directly to a printer, OBS: The printer is in the network shared. Can I, for example, do an axios request with a file?
user avatar
0votes
2answers
26views

uploading two files from two fields with multer as middleware

i'm trying to upload two files with different file extensions with multer from two fields but when i try it with postman the result always for the file is null, what is the solution for my problem? ...
user avatar
0votes
0answers
23views

How do I retrieve Console.log ran inside of a New Funtion()?

If I'm creating an anonymous function with the new Function() constructor, how would I grab the console logs from inside of it? For example: value = "console.log('test');"; response = new ...
user avatar
-1votes
0answers
26views

node index.js not working dont understand why [duplicate]

import DISCORDJS, { Intents } from 'discord.js' import dotenv from 'dotenv' dotenv.config() const client = new DISCORDJS.Client({ intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS....
user avatar
-1votes
0answers
18views

Javascript fetch with post and cors doesn't work

I have a really simple express backend and I'm trying to print the response to my POST Request in the frontends console. I always get the following result (frontend console output): sending body to ...
user avatar
  • 39
0votes
1answer
16views

How can i execute 2 seperate commands in a Dockerfile?

I have a Dockerfile that installs multiple services on a ubuntu baseimage such as npm, nodejs and ssh. I want be able to ssh into the container and also run a node express application. It works ...
user avatar
  • 13
0votes
0answers
9views

Can .pending be returned from a read stream on older versions of node?

I'm trying to port over some node code from a newer system(node v16.x) to an old system that is forced to stick with node v8.16.0. I'd like to get the result from .pending on a read stream object that ...
user avatar
1vote
1answer
15views

Why k8s ingress-nginx forward the reques to somewhere else?

In k8s, I deploy an app running with clusterIP(port:5270). Then I want to set up an ingress-nginx to forward the request to this app. here is the configure: apiVersion: networking.k8s.io/v1 kind: ...
user avatar
  • 71
0votes
0answers
8views

Node.js is showing in command prompt, but not in VS Code, how do I fix that?

I'm just learning coding and so please pardon any mistakes in my description. I'll try to be thorough. In VS Code I receive the error "node : The term 'node' is not recognized". I know that ...
user avatar
0votes
0answers
13views

Build Nest.js in docker got a Prisma erorr

I am building an application in nest.js ,then I want to dockerize it by using docker, this is my docker file: FROM node:14 AS builder # Create app directory WORKDIR /app # A wildcard is used to ...
user avatar

15 30 50 per page
1
2 3 4 5
8468