Route client to external site in node.js?
This may be stupadly easy, or just impossible - but it's worth asking in my opinion.
The reason is because I was trying to demo a quick and dirty (lol) url-shortening app.
app.get('/link/:key', function(req, res){
client.get(req.params.key, f开发者_C百科unction(err, reply){
if(client.get(reply)){
// route to reply here
}
else{
res.render('index', {
link: null
});
}
});
});
How would I perform that route, if possible?
http://expressjs.com/guide.html:
res.redirect('/', 301);
res.redirect('/account');
res.redirect('http://google.com');
res.redirect('home');
res.redirect('back');
精彩评论