我有Apache httpd服務器和node.js. 我需要模擬每次更改的真實JSON數據。Node.js運行腳本
我發現,我可以的node.js的服務器以獨立模式是這樣運行的:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/')
這很酷,但我無法通過AJAX請求訪問它,因爲有不同的端口。
問題:如何運行這個腳本,通過不同的路徑訪問,例如http://localhost/json
感謝(而不是standanole在另一個端口上運行),
嗯......好一個...但我通過的.htaccess 重寫規則做了^ json.html $ http://127.0.0.1:8124/ [P] – 2010-07-19 11:48:46