开发者

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');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜