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 the server side and therefore benefit from the re-usability of code and the lack of context switching.
472,498
questions
-7
votes
2
answers
2k
views
How can I run front end Javascript files with node?
I often times find myself wanting to run simple frontend javascript files with node for testing. however node does not understand document, and is not able to access elements in my html. Is there a ...
-7
votes
1
answer
32
views
next is not working properly in middleware using Nodejs
I am working with Nodejs and i am using expressjs, Right now i am working on middleware functions,I want to know the what "next" working in middleware concept ? "next goes to next ...
-7
votes
1
answer
462
views
How to solve "Message content must be a non-empty string" in node.js [closed]
Here is my code,
const { Client, Intents } = require('discord.js');
const mineflayer = require("mineflayer");
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS....
-7
votes
1
answer
453
views
How to call a function dynamically in Node.js [duplicate]
For web browser I can do like this.
function action(){
GLOBAL_VAR = 3
}
let GLOBAL_VAR = 0
let funcName = 'action'
window[funcName]()
console.log(GLOBAL_VAR)
How I can do this for Node.js ...
-7
votes
1
answer
49
views
JavaScript Replace }, with ,"_deleted":true},
Input:
{"_id": "1235625485","_rev": "1-jsdjsid456862"},
Output:
{"_id": "1235625485","_rev": "1-jsdjsid456862","_deleted":true},
-7
votes
2
answers
83
views
Not able to load angular project
I just installed angular 4 and generated the project, it is compiled correctly but it is not displayed in the browser
this is what my browser shows
-7
votes
1
answer
89
views
how can i create successfull popup window after register in php [closed]
first part
second part
How can I create successful popup window?
-7
votes
3
answers
87
views
Cannot understand this Js code
I am new to NodeJs, had experience in Java and Angular Typescript.
Some one has written this code that I am not able to understand, Can you please help me out ?, I tried printing output on the ...
-7
votes
1
answer
118
views
java script for loop program, stuck
Hi so ive never done JS before and im struggling to figure out what code should go in the '??????????' space. If some one could help me it would be much appreciated. (also struggling with opening the ...
-7
votes
1
answer
105
views
my global variable can not see in meteor
I have created a variable named myVar in a js file. The js file is located in the client folder of my meteor app.
I have checked that the js file has already loaded because the console.log('...') has ...
-7
votes
4
answers
235
views
Get value from (JSON) String
I have a String which i have passed on via a HTTP request. However i am unable to get the value out of it. The string is as following:
var a = {"health":"img/biking_cropped.jpg","budget":"img/...
-7
votes
2
answers
3k
views
Run node.js from the browser on client side
I need to run node.js from the browser (on client side).
Certainly the Node.js is already installed on the client
For a simple example. Html-page contains only one button. If you click on this button ...
-7
votes
2
answers
7k
views
angular 2 app-root not loading when running
I followed the instruction from here: https://angular.io/cli
I executed the following lines with no route option:
ng new test-test-projectthree
ng serve
I am suppose to see everything from app....
-7
votes
2
answers
283
views
Empty for loop behavior in node.js
I am trying to test for loop behavior in node.js. In Javascript/node.js for loop is synchronous but what if their is no statement in the loop.
For Example:
console.log("START")
for(var i=0; i<...
-7
votes
1
answer
236
views
I want to upload array of images with filename from React JS to express, Nodejs
I want to upload an array of images with filenames from React JS
The array contains filename and picture
-8
votes
6
answers
686
views
How do I reduce this code to one line?
I'm very new to javascript, node.js and express. My question is, how do I refactor the following code to make it one line inside the function?
exports.about = function(req, res){
var mytime = new ...
-8
votes
1
answer
8k
views
Combine Node.js and Java?
I want to process "values" passed from node.js to java (perform calculation, write results to DB).
On the server-side I receive information which is entered via node.js-based web application. Since ...
-8
votes
1
answer
59
views
What is the best method to bring a gigantic JS object to client side? [closed]
What is the best method to bring a gigantic JS object to client side?
-8
votes
2
answers
91
views
Does normal javascript works on node - webkit or not? [closed]
I used normal javascript in node - webkit for eg:
var blinkOrder = 20;
var blinkNumber = 12;
var asdf = document.title;
function asd(){
if (blinkNumber >= blinkOrder) {
document.title =...
-8
votes
1
answer
103
views
Transform string to JSON [closed]
Hi I have the following JavaScript object, how could I serialize it to a string in the JSON data exchange format?
var result = { "id": "358464" ,"t" : "MSFT" ,"e" : "NASDAQ" ,"l" : "28.03" ,"l_cur" : ...
-8
votes
1
answer
454
views
How can we make jquery terminal screen adjustable?
I am using jquery terminal to run commands in my project, in that I want to make its screen adjustable, I am unable to do that, can anybody help me?
-8
votes
1
answer
2k
views
What is the best way to query data conditionally in MongoDB (node.js)?
What I'm basically trying to do, is to render different look on the front-end (react.js) based on whether the user is part of the group or not. I tried conditional querying, looping on front-end etc.
...
-8
votes
1
answer
101
views
What is the best way to test a node.js web server for security issues? [closed]
How could we test our node.js webserver for security issues?
-8
votes
0
answers
34
views
javascript functions returning values before assignment is completed [closed]
I'm calling below function for which input will be sent one by one like below
input below:
const key = {
"keys": {
"all": false,
"...
-8
votes
1
answer
389
views
how do i send a private message to all people who have a certain role? (discord.js) [closed]
I want to create a command that works like this
<command> <roleName> <message>
and sends the message privately to all discord users with the specified role
Thanks in advance!
-8
votes
1
answer
97
views
Get the word, from a sentence that the user is talking about [closed]
This is a little bit of a weird question.
I am creating a selfbot in Node.js. That responds naturally.
And I'm trying to extract a variable from a sentence. To see what the user is talking about. I ...
-8
votes
1
answer
68
views
i'm working on the autocomplete for displaying the city name and also the city id in hidden,
Im getting the response as:
0: {id: "190", name: "Elurupadu"}
1: {id: "1230", name: "Sendhwa"}
2: {id: "1262", name: "Multai"}
3: {id: "1480", name: "Kherwara"}
4: {id: "2225", name: "Mandi"}
5: {id: ...
-8
votes
2
answers
89
views
Changing Dom to Jquery [closed]
Hi I was just wondering if anyone could help me find an equivalent function for dom values to convert it into Jquery.
If I have a code in DOM format:
var x = document.querySelector('#x');
what ...
-9
votes
1
answer
668
views
Porting MD5 from node.js to go [closed]
I have an authentication logic in node.js
var crypto = require('crypto');
var SaltLength = 9;
function createHash(password) {
var salt = generateSalt(SaltLength);
var hash = md5(password + salt)...
-9
votes
1
answer
137
views
Does the 'require' keyword in PHP and Node.JS do the same?
Does the require keyword in php and in node.js do the same, means they are both to load the external script?
-9
votes
1
answer
3k
views
Javascript loop within HTML code
I have the following lines (I'm taking a variable from the server, NodeJS using EJS for templating):
<% for(var i=0; i < gens.length; i++) { %>
<option value=<%= gens[i].gene %>&...
-9
votes
1
answer
557
views
Node.js vs. Rust, but Node.js is faster [closed]
I have a function named
grid
which is from the dynamic programming problem "grid Traveler". I wrote the same function twice in JavaScript and Rust and benchmarked 10 million calculations ...
-9
votes
3
answers
104
views
can someone please tell me why foreachloop is not taking i as 1 which is a variable that is used to check whether it is in exist in the array or not [closed]
k=[1,2,3,4,5,6,7,8]
i=1
k.forEach((element,i) => {
if(element===i){
console.log("TRUE")
}else{
console.log("False")
}
});
output: False
False
False
...
-9
votes
2
answers
100
views
Can NodeJs be used on the web just like php [closed]
Guys i'm new in Nodejs,
please can it be used on the web like php?
-9
votes
1
answer
78
views
If condition is always false in second loop for jade
I'm fetching the user data then fetching user plan and then comparing them to show user wise plan list.
if data.user_list[0]
each user_list,i in data.user_list[0]
tr
td.center img(src='...
-9
votes
1
answer
73
views
What is happening here in this code? [closed]
Can someone tell me what is happening here?I only know that it is requiring some core modules.
var inherits = require('util').inherits;
var express = require('express')();
-10
votes
3
answers
416
views
Discord bot not giving the username of the target
So I've been trying to make a command for my discord bot in which my bot should write the name of the target (the person I'm mentioning) in an embed, but unfortunately, nothing has been working.
bot....
-10
votes
1
answer
635
views
JSON object within JSON objects in Node.js [closed]
I am new to node.JS and currently working on a mini-project.
Problem Statement: I want to get the value of "window" but want to hide the key "window". Is there a way out for this in Node.js?
Input ...
-10
votes
1
answer
3k
views
"callback is not defined" in node js
This is part of my code, and it doesn't work. It says,
ReferenceError: callback is not defined
at C:\js\kweb-hw\routes\board.js:14:13
var express = require('express');
var router = express....
-10
votes
1
answer
98
views
How to create a server in Nodejs?
I am working on chat server so I want to create a server and I have been said to use express and socket.io module. Would someone explain me about these modules and help me making chat server?
-11
votes
4
answers
193
views
How to retrieve object property values with JavaScript?
In the following code, users is an object that I need to convert into an array with just the property values:
users = [
{ mobile: '88005895##' },
{ mobile: '78408584##' },
{ mobile: '88008335##'...
-11
votes
1
answer
118
views
Why this GET request is not working?
enter image description here
I am doing all this on codeanywhere
-13
votes
2
answers
2k
views
What is the equivalent of this in JavaScript? [closed]
var stuff = $($(r).find(".BuyPriceBox")).find(".PurchaseButton").data();
r is the response from the AJAX call
r is the web page response.
I want to write the above code in JavaScript, not using ...
-13
votes
1
answer
633
views
Is there a free way to utilise Amazon API without AWS? [closed]
I'm creating a project that needs to be able to grab products with JS and find the name of the product, average review, and import the main image.
I realize that Amazon has an API for this but is ...
-17
votes
1
answer
733
views
Setting NodeJS path in Windows XP for SublimeLinter Framework
I am using Windows XP and using Sublime Text 3 build 3126. I'd like to use the SublimeLinter framework with it, but they are listing NodeJS as a dependency. How can I ensure that NodeJS is available ...
-24
votes
1
answer
510
views
Why am I getting the error "is not a function" here? [duplicate]
I have a nodejs issue here, and I really don't know why it happens.
Here is my code :
isInTimeSlot() {
return new Promise((resolve, reject) => {
var date = new Date()
var hour =...