在下面的代码中我做错了什么
var path = 'http://' + someip + ':' + port ;
//var path = "http://someip:1000/"; // This is working
res.writeHead(302, {'Location': path});这方面的任何帮助都会很有帮助的。
发布于 2013-12-02 05:23:39
很难用两句话来理解你的问题,你可能做错了其他事情。这应该是你要找的。
var express = require('express');
var app = express();
var someip = '127.0.0.1';
var port = '8080';
app.get('/hello.txt', function(req, res){
var path = 'http://' + someip + ':' + port ;
body = 'Redirecting to ' + path;
res.writeHead(302, {'Location': path, 'Content-Type': 'text/html'});
res.end(body);
});
app.listen(3000);https://stackoverflow.com/questions/20321389
复制相似问题