35 questions
1
vote
1
answer
26
views
Node.js is generally code running on the server; what role does it play in front-end project development?
Generally, when writing vue.js front-end projects, node.js is used. For example, npm installs some node.js three-party packages to node_modules/.
Excuse me, node.js is generally the code running on ...
0
votes
1
answer
254
views
how to throttle node.js http.get(...)
I'm trying to scan a network and limit the resources (bandwidth, sockets, etc.) being used. I thought I could use http.globalAgent.maxSockets with http.get().
My test code is:
// node.js v6.11.3
...
1
vote
2
answers
2k
views
res.write is not returning the expected value
This is the code:
var http = require('http')
var options = {
hostname: 'localhost',
method: 'POST',
port: 8000,
path: '/'
}
var s = 3;
http.request(options, (res)=>{
}).end(s+...
4
votes
5
answers
2k
views
Why clearInterval doesn't work on a function
this is the code
var t = ()=>{
setInterval(()=>{
console.log('hello')
},1000)
}
t();
clearInterval(t)
Why the clearinterval does not block execution of the setInterval?
-1
votes
3
answers
154
views
Why not print the date?
This is my code, there are 2 files:
file b.js
module.exports.data = function() {
return new Date();
}
file a.js
var a = require("./b")
var http = require('http')
http.createServer(function(req, ...
2
votes
2
answers
268
views
Http.request in node.js
This is my code in node js:
var http = require('http');
var options = {
host : '127.0.0.1',
port: 8124,
path: '/',
method: 'GET'
};
http.request(options, function(res){
...
1
vote
1
answer
1k
views
I want to send a CTRL + C command to client how can I achieve this in NodeJS?
My Code Looks Like this
var Client = require('ssh2').Client;
var fs=require('fs');
var conn = new Client();
conn.on('ready', function() {
console.log('Client :: ready');
conn.shell('xtail', ...
1
vote
1
answer
2k
views
How to install Node.js on Windows 10?
I tried to install Node.js on the Windows 10 64 bit using installer.
When I run installe.exe I accept rules and push next button, in any case I get the following notification:
When I tried to set ...
2
votes
1
answer
2k
views
Phoenix Channel sending messages from a client outside the project
I wanted to send a message to my user channel of my Phoenix Application. I have joined a user_token with the channel as users:user_token in the user_channel.ex . I was successful doing it from another ...
0
votes
1
answer
147
views
Node.js: variable to act as nested element name for an object [duplicate]
Here is my object:
obj = {
"FirstName": "Fawad",
"LastName": "Surosh",
"Education": {"University": "ABC", "Year": "2012"}
}
Here is my node.js code:
var nodeName = '...
0
votes
2
answers
451
views
require('use-strict') doesn't work for me
here, I am attempting to set value for read-only property but I am not getting any error:
HERE IS MY CODE:
require('use-strict');
function Employee(firstname) {
var _firstname = firstname;
...
0
votes
0
answers
66
views
Using "jsonfile" API throws error
var http = require('http');
var jsonfile = require('jsonfile');
var util = require('util');
http.createServer(function (req, resp) {
if (req.method === "GET") {
var file = "./files/file1....
2
votes
1
answer
7k
views
Node.js 'net' module Handling Multiple TCP clients
Respected,
I use Node.js to create TCP client using 'net' module to connect with Hardware device(Which only supports TCP Protocol) which Streams data when available,so that I could listen on('data',...
0
votes
3
answers
2k
views
how do we encode each byte as two hexadecimal characters in ruby?
I have a hexadecimal number as
hexMidAppId = '0001000000000002'
In node.js, we have a library new Buffer(hexMidAppId, 'hex') which gives me the output as
<Buffer 00 01 00 00 00 00 00 02>
now ...
1
vote
0
answers
143
views
node readline, node http
I'm writing a command line interface which queries a REST server in nodejs.
I read commands from the user using node's readline.question. I send via http.request, (using cujojs, which however,
I don'...
1
vote
1
answer
431
views
Mystery TCP error in node TLS client
I have several node tcp clients and a tls client that connect to external servers:
var socket = net.connect(args.connect.ip_port, args.connect.host);
socket.setTimeout(this.timeout);
...
19
votes
3
answers
9k
views
What is the difference between local and global module in Node.js? When to use local and global module?
We can access local module using require function but cannot access global module through it.
I read somewhere that to use global module we need to make it local then import it through require ...
1
vote
2
answers
4k
views
how to folder synch between a node.js server and node.js application
A node.js client application needs to synch a folder with a remote node.js server. Both are running on windows.
The synch only needs to be one-way, from server to client and some way of knowing when ...
1
vote
0
answers
273
views
Run node script from project path
I am running on win 7 and have installed nodeJS as a path variable.
I have installed a nodeJs module(pusher) in my laravel project and got the following folder structure a folder, when adding a ...
0
votes
1
answer
47
views
Need help http Server and client server
I have used an application for login, adding friends and chat using node.js and mongoDB.I installed the node.js and monogoDB on ec2 instance. However, I do not know if need to use client server and ...
1
vote
1
answer
255
views
Derby.js Front end and Backend interaction
I'm new to NodeJs and i'm a core java developer. Can anyone explain me how DerbyJs interacts with Backend and how backend replies to frontend in turn?
I can see many functions. not sure which function ...
0
votes
0
answers
939
views
How can I access file system from an external javascript file?
I have a file named server.js which reads an HTML file named "game.html".
That HTML file is linked with an external javascript file named "game.js".
In server.js file
if(request.url.indexOf('....
5
votes
2
answers
5k
views
Windows Azure Node JS WEBSOCKET HandShake Fails 503 Error
I've deployed my nodeJS server in windows azure.
My client fails while connecting to server and handle the following error :
WebSocket connection to 'wss://ooplrfrfranode.azurewebsites.net/socket.io/...
-1
votes
2
answers
277
views
Undefined method flash in the view of node.js
Problem in accessing flash messages on view in node.js
In my Controller
this.req.flash('info','successfully submited');
this.redirect("/home");
In my home view I am not able to get flash messages as
...
0
votes
0
answers
153
views
multiple http connections to test NAT
I'am in a project where i need to establish the most possible http connections and keep them open for nat port testing, using node.js but I'm not sure how I could do it, till now i got this:
var http ...
1
vote
1
answer
3k
views
WS websocket send() as a function
I'm having some issues with this. I'm connecting with socket.io (works) to another server, I want to send by WS to a client (processing). The main problem is that it just sends once, I want to send ...
0
votes
1
answer
585
views
nodejs socket io cannot call emit of undefined. Causes?
I am using nodejs and socket io. The underlying purpose for the code is to ask for data from the server and to post it on the client website.
I have it made so that every 10 seconds, data is ...
0
votes
2
answers
1k
views
How to query mysql before starting http server in nodejs
A simple question, I use nodejs for HTTP restful API service. Now I want query some mysql data before http server start, the code snippet:
var price = -1;
var userId = 'some user provided value';
...
5
votes
3
answers
8k
views
pipe child process stdout & stdin to browser in node.js & browserify
I am attempting to pipe the stdout & stdin of a child_process to a browser & display it in an html page. I am using browserify to get node.js to run on the browser. My code for spawning the ...
2
votes
1
answer
728
views
Node socket.io client listens to events sent to the other client
I built a simple Node socket.io server, and two simple Node socket.io clients. Each client connects to the server, sends a single request, waits for the response, and prints it. The problem is, each ...
0
votes
1
answer
1k
views
how to connect node.js rest client with UI [closed]
I am new to node.js. I have a question regarding connecting my node.js with UI. I have a node.js server which produces rest API with basic authentication. I have written a node.js rest client which ...
11
votes
2
answers
46k
views
how to do Auth in node.js client
I want to get use this rest api with authentication. I'm trying including header but not getting any response. it is throwing an output which it generally throw when there is no authentication. can ...
0
votes
0
answers
401
views
Working Node.js modules into an application directory structure
I've begun using Node.js to make web applications. It's really awesome. I've come across a few modules that I want to incorporate into my build. I can work with the modules in Terminal after a global ...
46
votes
2
answers
156k
views
Node.js - How to send data from html to express
this is form example in html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>CSS3 Contact Form</title>
</head>
<body>
<div id="...
32
votes
3
answers
40k
views
Windows Integrated Authentication in node.js Client
When using node.js as a client, is it possible to connect to a server using Windows integrated authentication (e.g. when connecting to IIS)?
My searches for this only turn up results where node.js is ...