Questions tagged [nodejs-server]
405 questions
0
votes
0 answers
How to run server.js file in nodejs
Tried to run nodejs application.If i run node server.js i am getting module not found error.All files path is correct but i am getting module not found error.How to resolve this issue?
I have shared the errors below with folder structure:
Folder…

Nila Vaani
- 203
- 1
- 8
- 27
0
votes
2 answers
How to create http and https server in nodejs?
This is the code I used to connect http server.
var app = require('http').createServer(require('express')),
io = require('socket.io').listen(app),
util = require('util'),
connectionsArray = [], // maintain active connected client…

Shamnad
- 35
- 5
0
votes
2 answers
how to fetch data based on ISODate in Nodejs?
I have data in the ISOdate format in MongoDB. When I run the query in mango shell it works correctly.
But the same query when I used in nodejs it gives an error
USED IN NODEJS
router.get("/api/status/:id0/:id1",async(req,res)=>{
…

harry
- 31
- 4
0
votes
1 answer
Bcrypt NodeJS compare password always returning false
So obviously i am using bcrypt to register and hash my password and that works.
And now i am making an login where i have to compare the form password and the hashed password in the database and this is how i do this:
// Get post data
let email =…

TehGaz7
- 121
- 2
- 11
0
votes
1 answer
Smart Home TemperatureSetting reading(celsius) custom range
I am using action.devices.types.THERMOSTAT with action.devices.traits.TemperatureSetting, i want to set custom range for Celsius from 16 to 28 is it possible ? i have tried using bufferRangeCelsius attribute but it did not produced any effect on…

zaheer ahmed
- 69
- 1
- 5
0
votes
1 answer
Using NodeJS Express server with PM 2 in cluster mode
So, I will try and explain this to the best of my ability:
I wrote a TCP server that accepts data from a wearable (type of gps bracelet), using net in NodeJS. TCP server has connections = {} property, which contains all the connections, like…

dkasipovic
- 5,930
- 1
- 19
- 25
0
votes
2 answers
NodeJS Express routes in external file 404 Not Found
I'm new to NodeJs and express. My goal is to have a separate route file that contains all my application routes. So I created a file called routes.js. The content looks like this:
const express = require('express');
const router =…

Markus
- 1,909
- 4
- 26
- 54
0
votes
1 answer
How to use logging middleware created in server.js file in a imported route file
I have quite confusing issue in my plate,
I have a server.js which is my first app entry point:
const test = require('./routers/test')
const express= require("express")
const pino = require('pino');
const expressPino =…

Learner
- 1,686
- 4
- 19
- 38
0
votes
1 answer
what could be the error in socketio when using with express?
I have tried many methods to connect socket-io client and server with express but its not working and now i do not know what could be error.
i have tried to clone example available on socket-io website still it does not show any connectivity or any…

Muhammad Hamza
- 61
- 8
0
votes
1 answer
Storing API search results in local database
Every time someone hits an API route I want to store that information in database, connected with req. IP.
Afther I would like to find some association rules based on similar searches.
Should I store some information in cookies or to use local…

Andrija Novakovic
- 113
- 5
0
votes
1 answer
When boolean turns false, check 5 seconds if it will turn back to true, else do some action
I have in NodeJS a variable that updates every second. I want to monitor it to see if it turns below a certain threshold (e.g. 1000).
If it does go below the threshold, it should wait 5 seconds and monitor if the variable goes back above again. If…

Sydney Smit
- 21
- 4
0
votes
1 answer
cannot en queue handshake after already en queuing a handshake In socket IO?
cannot enqueue handshake after already enqueuing a handshake error found. Please solve my problem].
in SQL connection in Nodejs.
Here is my code :
io.on('connection', function(socket) {
con.connect(function(err) {
…
user11868862
0
votes
1 answer
How to iterate json data in txt file using node js?
I tried to Iterate json data in txt file using file(fs) module.its json data is string format but I want object format.how to achieve it.
amd.txt
{
"first_name":"iball"
}
{
"first_name":"ibell"
}
product.js
fs.readFile("amd.txt","utf8", (err,…

hari prasanth
- 716
- 1
- 15
- 35
0
votes
2 answers
Node - Cannot require('./index.js') in the same folder
I have a folder src/config in which I have multiple files a.js, b.js, c.js and index.js
When inside b.js I do
const data = require('./index');
OR
const data = require('./index.js');
I always get an empty object which is really strange
//…

d_bhatnagar
- 1,419
- 1
- 12
- 20
0
votes
1 answer
Hosting NodeJS on a Local Network
Currently, I am trying to host my app on my company local network. I realised that when I connect to my company Wifi, different devices connected to the same WiFi network, have different IPv4 Address. I want to be able to host this app such that all…