Questions tagged [nodejs-server]

207 questions
8
votes
1 answer

The "chunk" argument must be of type string or an instance of Buffer

I'm running the following code and it fails with the below error. AWS Code to list all objects inside a bucker const http = require('http'); const host = '127.0.0.1'; const port = 5000; const path = require('path') const url = require('url') const…
anish anil
  • 1,210
  • 5
  • 14
  • 31
8
votes
3 answers

NodeJS environment variables undefined

I'm trying to create some envrioment variables but when I create the file and run the server the seem to be undefined. I'm using nodemon. I have restarted my server and no luck. UPDATED .env MONGO_ATLAS_PW = "xxxx"; JWT_KEY =…
devpato
  • 3,994
  • 6
  • 29
  • 67
5
votes
1 answer

AWS Lambda using Node Js gives "connect ETIMEDOUT" on http.request()

I have written lambda function that retrieve s3 Url whenever any new object created on s3 bucket. after retrieve s3Url this lambda make request to my server over REST Call. I observed cloud watcher. It failed to send request to my Server I don't…
4
votes
1 answer

How are concurrent requests handled by Nodejs express http server?

I am building a Node.js application and wanted to understand how concurrent requests are handled. I build a test server, where high CPU load is being simulated by waiting 10 seconds. To test the behavior, I open two browser tabs and refresh the page…
3
votes
2 answers

close server from within router

I create an express app like this const express = require('express') const app = express(); app.use(express.static(path.join(__dirname, 'public'))); app.post('/close', async (_, res) => { res.status(200); res.end(); …
theonlygusti
  • 7,942
  • 8
  • 40
  • 80
3
votes
1 answer

Nest Js (Node Js Framework) - How to start server on Digital Ocean using pm2?

I have developed my project in the Nest JS framework. My main file in the src folder (src/main.ts). How can I start the server on my Digital Ocean server?
3
votes
2 answers

Why we pass "app" in http.createServer(app)

Why we pass "app" in http.createServer(app) as we can also pass e.g : var app = require('./app') const http = require('http') const port = 3500 || process.env.PORT var server = http.createServer(app) //here we pass app in other code we pass…
Amaan Imtiyaz
  • 121
  • 1
  • 12
3
votes
0 answers

NodeJS keep getting Failed to load resource: the server responded with a status of 404 (Not Found)

I'm trying to run a login project within nmp, I initialized the project, then the data base side. For now, when I try to run index.html and I get the mentioned above error. As well I'm not sure how to configure the "Run Configuration" of the…
Victoria
  • 76
  • 10
2
votes
1 answer

Is a -dynamic- PHP app more performant than a NodeJS one?

I'm new to NodeJS, coming from mostly PHP, and am building an app that requires a fresh HTML serve from the server on each request - Node serves HTML with the EJS templating engine - no SPA framework. I've stumbled upon a case when I'm not sure if…
Danigoodw
  • 339
  • 2
  • 9
2
votes
2 answers

Socket.IO using Node.js and Swift server not detecting connection? [AWARDING SOON]

When I try running SocketTutorialManager.init() when a button is pressed, the different functions in the initializers should run, but they don't and I instead get the following printed to the Xcode console: 'sockettest[70290:1461156] []…
nickcoding
  • 31
  • 3
  • 13
2
votes
0 answers

Performance implications of using Async Hooks

I'm the author of a Node.js library and I want to use Async Hooks to improve DX. But I'm worried about performance. I've read stories saying that everything is fine, as well as stories where performance was a blocker. In theory, asynchronicity…
brillout
  • 8,117
  • 9
  • 60
  • 74
2
votes
1 answer

Do I *need* to use next(err) with Express.js?

Basically, the question is do I need to use next(err) when encountering any errors? The nodejs error documentation says it is fine to use a standard sort of if(err) else... for asynchronous callbacks and EventEmitters, as long as the error isnt…
LongStreak
  • 31
  • 3
2
votes
0 answers

Nodejs: Override global.eval

Is there any way to safely override eval? Have tried directly overriding: var oldEval = global.eval; global.eval = function(){ // my logic global.a+=1; return oldEval.apply(this, arguments); } This somehow gives the following reference…
2
votes
1 answer

How does A Node.js Web Server Keep Running Even When There Are No Callbacks To Be Executed In The Event Loop?

The code below is a simple Node.js web server that responds to a request when the URL is matched. Researching online about node.js it is stated that once you start your script (node index.js) callbacks will be placed in their appropriate phase,…
claOnline
  • 665
  • 1
  • 5
  • 10
2
votes
0 answers

How to calculate the appropriate value of UV_THREADPOOL_SIZE for a NodeJs application

I have a NodeJS application using express as web framework, exposing a single API that receives a JSON file and uses the data of the json file to fill up a word document template and generate a PDF which is delivered as download in the API…
T.S.
  • 182
  • 2
  • 12
1
2 3
13 14