2014-10-29 42 views

回答

12

在服務器的路線,你可以訪問節點的response對象。舉個例子,302重定向可能看起來像這樣:

Router.route('/blah/:stuff', function() { 

    var redirectUrl = 'http://example.org/' + this.params.stuff; 

    this.response.writeHead(302, { 
    'Location': redirectUrl 
    }); 

    this.response.end(); 

}, {where: 'server'}); 
+0

Thx,它的工作原理,但我如何保存POST數據? – 2016-07-22 16:26:00

+0

@SimoneM由客戶端重新POST到正確的URI。 HTTP 301或302僅用於通知瀏覽器有一個新的URI可供使用。 – 2016-10-18 02:14:55