Question: I have 2 routers

router1

```
app.post ('/ consultations', function (req, res) {

    req.session.nombre = 'administrator';
   console.log ('test', req.session.name); // there the session is saved well
});

```

router2

```
router.get ('/', function (req, res) {
    console.log ('retrieve session', req.session); // exit undefined
}

```

How can I get the session on the two routers?

EDIT:
i created a middleware 

```
function mymiddleware(req,res,next){
  req.session.nombre='MiNOMBRE';
}

```

and I try to get the middleware;

```
app.get('/miroute1',mymiddleware,(req,res) => {
      console.log(req.session.nombre);//

```

but never enters
 }

```
 app.get('/miroute2',mymiddleware,(req,res) => {
          console.log(req.session.nombre);//
but never enters
         }

```

Answer: 
It's hard to answer this question because it keeps changing ;-) The version I'm answering asks whether there's a faster way than:

```
a=[]
for item in data:
    if item not in a:
        a.add(item)

```

That will be horridly slow, taking time quadratic in `len(data)`. In any version of Python the following will take expected-case time linear in `len(data)`:

```
seen = set()
for item in data:
    if item not in seen:
        seen.add(item)
        emit(item)

```

where `emit()` does whatever you like (append to a list, write to a file, whatever).

In comments I already noted ways to achieve the same thing with ordered dictionaries (whether ordered by language guarantee in Python 3.7, or via the `OrderedDict` type from the `collections` package). The code just above is the most memory-efficient, though.
You can try this,

```
a = list(set(data))

```

A List is an ordered sequence of elements whereas Set is a distinct list of elements which is unordered.