Hello !

I summarized part of the code to not dirty list with a lot of text.

I must indicate that I have programmed from scratch twice this part
avoiding using variable names elsewhere. Console shows me correctly the
data to be displayed on the web and often works until some time (I have not
found exactly in which moment fails or pattern to use to replicate the
fault) shows values of other schemes and no returns to display properly
until you restart the application. I have not found a pattern, I tried to
browse the remaining sections, insert data, delete, and always console
shows me the correct data, but the browser displays other blended. Also in
my development computer I think it works correctly (I do not work with real
data), only fail in server, in which I run with forever+nodemon as I can
not keep an open session.

I tried to let it run with screen + nodemon (I can not leave a session open
ssh because if loses connection nodejs dies); moment works in a few hours
able to tell them something (I deleted forever because it is the only thing
different my computer).

The code is as follows:

- Nodejs + Expressjs

app.get('/brand/:identifier', function(req, res){

    identifier = req.params.identifier.toLowerCase();

    brands.find({ active: true, 'brandName' : { $regex : new
RegExp(identifier, "i")} }).populate({

                        path: 'shop'

                        ,select: 'name shop description'

                    }).sort({dateAdded: 'desc'}).exec(function(err, doc) {
        if(doc && doc.length) {

            console.log('Data doc: ' + doc);

            return res.render('brand_list', {
                                                shop: doc[0].shop.shop
                                                ,name: doc[0].shop.name
                                                ,description:
doc[0].shop.description
                                                ,products: doc
                                                ,pageTitle: doc[0].shop.shop
                                                ,pageUrl: '
http://backofficeserver.local/brand/' + identifier
                            });

        } else {

            return res.render('listado_shop', {
                                                shop: doc[0].shop.shop
                                                ,name: doc[0].shop.name
                                                ,description:
doc[0].shop.description
                                                ,error: 'Not product´s
found'
                                                ,pageTitle: doc[0].shop.shop
                                ,pageUrl: '
http://backofficeserver.local/brand/' + identifier
                                                });

        }
    });

});

- Jade (resumed)

if error
  h4= error
else
  h4= 'List of products'
  if products
    each product in products
      li.product(id=product.identifier, name=product.identifier)
        a(href='/show/' + product.identifier, target='_blank')

They know of any tools to debug node js code? Thanks.

Regards
Anto


2014/1/28 Ryan Schmidt <[email protected]>

> Presumably you are storing some information in a variable that is not
> associated with the request, and is therefore shared among all requests.
> The code you posted doesn't seem to have such a problem, so I'd look
> elsewhere in your code.
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "nodejs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nodejs/2SxmvchhHaM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to