title: Web service with D3.js and Express.js, and several requests simultaneously
body: <p>I have tried to find an answer to my problem but I have had no luck. I apologize in case this has already been answered.</p>
  
  <p>I am trying to write a web service with Express.js. Here is my code:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  app.get('/getgraph', function(req, res) {
      var d3 = require('d3'); 
  
      // Creating svg stub
      var graphContainer = d3.select("body")
          .append("svg") 
          .attr("id", "graph");
   ...*rest of the code*...
  }
  </code></pre>
  
  <p>The problem is that when I call my service from two different browsers at the same time, two svg containers are added. What, I want is that each request gets it's own  elements. How can I achieve this? I know that JavaScript is single threaded, but I would guess that d3 is in the scope of a request not in the scope of the server. </p>
  
  <p>Thank you!</p>