Add support for redirect. #5

Closed
tylerbenson opened this Issue Dec 21, 2011 · 9 comments

Projects

None yet

3 participants

@tylerbenson

I would like to be able to redirect a site to a url that is a result of a database call.

@rauchg
Contributor
rauchg commented Dec 21, 2011

How would this behave exactly? What happens if the result is null?

@aheckmann
Contributor

also would need to specify which field name of the document being returned holds the url. seems like it isn't a good fit for express-mongoose to me.

@tylerbenson

I was thinking more of using it in conjunction with static methods. For example, in a document, I have a URL split up by server and path. I would then call:
res.redirect(News.getURL())
where in that static call a promise is returned and resoloved by a full url path.

@aheckmann
Contributor

ok, so if the result is null, just pass to next() like with render/send?

@tylerbenson

Not really familiar with that... never tried passing null to those. I would just expect some sort of error though, right?

Does this seem like a good idea?

@rauchg
Contributor
rauchg commented Feb 29, 2012

Upon null we should probably next(new Error('URL expected')). I'm down for adding this

@aheckmann aheckmann added a commit that closed this issue Feb 29, 2012
@aheckmann aheckmann add res.redirect support
closes #5
3a50f03
@aheckmann aheckmann closed this in 3a50f03 Feb 29, 2012
@aheckmann
Contributor

available in 0.0.5 on npm

@tylerbenson

Awesome! Thanks for doing that.

@rauchg
Contributor
rauchg commented Mar 1, 2012

Thank you for the idea :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment