Marcelo Tosco | 21 May 21:12
Picon
Gravatar

Re: jade question about radio button options

Dont know the reason, but if the label starts with an uppercase letter sometimes fail. Use "|" as prefix to solve the problem:

div.control-group
  label.control-label Género
  div.controls
      label.radio.inline
          input(type="radio", name="optionsRadios", id="optionsRadios1", value="option1", checked="")
          |Male

      label.radio.inline
          input(type="radio", name="optionsRadios", id="optionsRadios2", value="option2")
          |Female

--
You received this message because you are subscribed to the Google Groups "Express" group.
To view this discussion on the web visit https://groups.google.com/d/msg/express-js/-/D3i-b9lZPX4J.
To post to this group, send email to express-js-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to express-js+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.
Roy Hasson | 23 May 01:29
Picon

Why are all my URLs appended with #_=_

I have a simple Express app and whenever I call res.redirect() the 
resulting URL has a #_=_ appended to it at the end.

Any ideas why this happens?

Thanks,
Roy

Piotr Rybałtowski | 20 May 10:26
Picon
Gravatar

Translations (i18n) in Express

Hi,


I found in this group a really old topic about i18n in Express. I'm now starting to develop a rather big application with Express and I want it to be internationalized.

I know Express won't have anything like that incorporated by default and I like it. But are any of you developers have by the time any preferences on which i18n module to choose? Node.js modules list has about 15 different node.js modules for this (some for l10n). Any advice from someone with experience in this field?

Thanks,
Piotrek

--
You received this message because you are subscribed to the Google Groups "Express" group.
To view this discussion on the web visit https://groups.google.com/d/msg/express-js/-/izhNVPr1YkkJ.
To post to this group, send email to express-js-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to express-js+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.
Marcelo Tosco | 21 May 21:13
Picon
Gravatar

Re: jade question about radio button options

Dont know the reason, but if the label starts with an uppercase letter sometimes fail. Use "|" as preffix to solve the problem:

div.control-group
  label.control-label Género
  div.controls
      label.radio.inline
          input(type="radio", name="optionsRadios", id="optionsRadios1", value="option1", checked="")
          |Male

      label.radio.inline
          input(type="radio", name="optionsRadios", id="optionsRadios2", value="option2")
          |Female 

--
You received this message because you are subscribed to the Google Groups "Express" group.
To view this discussion on the web visit https://groups.google.com/d/msg/express-js/-/i5EcV5ZXMHMJ.
To post to this group, send email to express-js-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to express-js+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.
Robert | 21 May 09:44
Picon

How do I get the query string from a request?

I would appreciate some help with a basic problem I'm having. I'm sure
there's something I'm missing in the documentation. I'm running Ubuntu
12.04 in a VM using node.js 0.6.16 and express 2.5.9.

My problem is that I am unable to grab the full query string from a
request. Here is the code I am trying to use:

"var express = require('express'), app = express.createServer();

app.get('/fetch', function(req, res) {
	console.log(req);
	res.send("query: " + JSON.stringify(req.query));
});

app.listen(3000);
console.log("Server started.");"

Next, I try the following command with the server running:

curl localhost:3000/fetch?a=b&c=d&e=f

Here is the response:

"[1] 5588
[2] 5589
robert <at> robert-VirtualBox:~/app$ query: {"a":"b"}
[1]-  Done                    curl localhost:3000/fetch?a=b
[2]+  Done                    c=d"

What's more is that, when I dig into the req object I logged in the
console, I see that it has the property originalUrl: '/fetch?a=b',
which is not the URL requested. Have I misconfigured Express in some
way? I am sure that I have, but I don't know how.

Edmund von der Burg | 22 May 16:41
Picon
Gravatar

Examples of using compiled jade templates in the browser

Hello,

I'd like to compile my jade templates down to javascript using 'jade
--client' and then use them on the browser to render content (using
the runtime.js code). But I'd like to see some examples of how others
have done this.

Things I'd like to look at are how best to send the compiled templates
to the browser, how to run the functions on the browser. When they are
created all the functions have the name 'anonymous' - is this
something that I should change when packaging them up?

I feel like I'm missing something and that the lack of examples is
because it is easy.

Thank you,
  Edmund.

asbo panda | 22 May 10:44
Picon
Gravatar

Passing app to my routes.

Hi All.

i want to use app in my routes/index.js file

here is what i am trying to do.

// app.js
--------------------------------------------------------------------------
app.get('/sound-cloud/auth/', routes.scAuth);

//  routes/index.js
-------------------------------------------------------------------------
/* Sound Cloud Auth View */
exports.scAuth = function(req, res, app){

    var authMessage = req.query["code"];
    if(authMessage == undefined){
        title = "void";
    }
    else{
     title = "ok"
     -------------here i want to set up a session------------
     app.use(express.cookieParser());
     app.use(express.session({ logInAuthCode: authMessage }));;

------------------------------------------------------------------------
   }
    res.render('index', { authMessage : authMessage });
};

Well of course i get an error cos i can not access the app from the
app.js file.  so how do i pass the app function through to my route.
or am i ment to use req, res instead.

thanks for all your help.

asbo panda | 22 May 10:40
Picon
Gravatar

Passing app to my routes.

Hi All.

i want to use app in my routes/index.js file

here is what i am trying to do.

// app.js
--------------------------------------------------------------------------
app.get('/sound-cloud/auth/', routes.scAuth);

//  routes/index.js
-------------------------------------------------------------------------
/* Sound Cloud Auth View */
exports.scAuth = function(req, res, app){

    var authMessage = req.query["code"];
    if(authMessage == undefined){
        title = "void";
    }
    else{
       title = "ok"
  app.use(express.cookieParser());
  app.use(express.session({ secret: "me@..." }));;
   }
    res.render('index', { authMessage : authMessage });
};

Well of course i get an error cos i can not access the app confing
from the app.js file.  so how do i pass the app function through to my
route.  or am i ment to use req, res  instead

Alan Hoffmeister | 22 May 01:58
Picon
Gravatar

Need an idea

Hello there!

I need some ideia to make this work , I need to generate a thumbnail
from an image inside the view, and return an unique id to insert into
the <img> tag.
In PHP I was using this in the view:

<img src="<?php resize($image, 'crop', 200, 200) ?>" alt="Hello world!" />

This way, the RESIZE function would crop $image, cache it and return
the full URL for the cropper image, and a possible output would be
like:

<img src="/thumbs/hnd13ud01fd028f084ru" alt="Hello world!" />

But I don't know how I can do this if I can't use async inside the views!

Any ideas?

--
Att,
Alan Hoffmeister

Prashanth | 21 May 08:35
Picon
Gravatar

Cannot read property '0' of undefined

Request handler thrown exception: TypeError: Cannot read property '0'
of undefined
    at next (node_modules/express/node_modules/connect/lib/http.js:145:18)
    at Server.<anonymous>
(node_modules/express/node_modules/connect/lib/http.js:216:3)

I getting this error on few of the requests, though the version is
express 2.5.2 i am trying to debug what caused the problem any
pointers?

--

-- 
regards,
Prashanth
twitter: munichlinux
irc: munichlinux, JSLint, munichpython.

Thomas | 20 May 12:39
Picon

Bug: Express session problem with iframe in facebook canvas app with IE

Hi

I have a canvas app on facebook and I'm having a problem getting the
session cookie in my request.
It seems like IE only have this problem. Other browsers work well.
I set P3P='HONK' header and tried to set the cookies manually using
response.cookie('connectID',  'some value'); and it worked! However,
in the below case, things don't work:

	app.use(express.session({
	    secret: 'gg4jklg54654k6j45kl45lgfkenj',
           // connect-memcached is used to store sessions
	    store: app.sessionStore,
	    fingerprint: function(){ return ''; },
	    key: 'consid',
	    cookie: {
	    	httpOnly: false,
               // I tried the true value as well
	    	secure: false,
	    	expires: new Date(Date.now() + (3600000*24*8))
	  }}));

in m view function Im doing:

function(req, res) {
    // this line doesn't set and cookie with the name consid
    res.cookie('consid', req.session.id);

    // This successfully sets the cookie with the name  considddddd
    res.cookie('considddddd', req.session.id);

    res.render('home');
}

So that, any cookie has the name equals to the string used in express
session initialization code can't be set neither by the session
middleware nor manually. It works (manually only) when I change it as
in the second line.
BTW, I'm using https
I need the session middleware to be able to set the cookies as it does
with any browser!
This problem is in IE8,9 ONLY. And only in facebook canvas
application.

Thanks in advance
Thamas


Gmane