Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6942191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:58:57+00:00 2026-05-27T12:58:57+00:00

http.createServer(function(request, response) { console.log(New request :+request.url); var found = false; for(var i= 0; i

  • 0
http.createServer(function(request, response) {
console.log("New request :"+request.url);
var found = false;
for(var i= 0; i < requests.length; i++){
    match = requests[i];
    if(match.method == request.method && request.url.match(match.regexp))
    {
        console.log("Matched request: "+match.url);
        pg.connect(databaseUrl, function(error, client) {
            if(error)
                processError(response, error);
            else
                match.action(client, request, response);
        });
        found = true;
        break;
    }
}
if(!found)
    processError(response, "Request url does not exist: "+request.url);
}).listen(3000);
sys.puts("Server running... waiting for requests");

Hi everyone. I’m stuck with this code. Whenever I call 11 times the same request, nodejs stops responding and does not even logs “New request: “+request.url.
Anyone has an idea of what’s going on ?

Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:58:57+00:00Added an answer on May 27, 2026 at 12:58 pm

    Sorry for the late come back.
    I found what was the problem but don’t completely understand it.
    In the connect loop, I was using functions which were actually only simulating values (normally captured by a request). This was the problem. If you don’t issue any database request in the pg.connect and loop on it, it seems the connections do not close properly. So the connection pool apparently breaks.
    Hope I’ve been clear enough.

    Anyway thank you for your help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Checking the simple code var http = require('http'); var server = http.createServer(function(req, res){ console.log(Got
Given the following code var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type':
in this very simple example: var sys = require(sys), http = require(http); http.createServer(function(request, response)
I'm trying to learn node.js. I made a http server: http.createServer(function(request, response) { response.writeHead(200,
Using the simple example var server = http.createServer(function(req, res){ var output = {message: Hello
The http.get() function inside http.createServer is not responding. I wrote a small snippet to
Given code like this from a node.js neophyte like me: require('http').createServer(function( req, resp )
var http = require('http') , io = require('socket.io') , fs = require('fs') , url
When making requests in Node.JS to another HTTP server, you can listen for when
I have written a http server using node js var sys = require(sys), http

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.