我正在测试给出请求的 URL,但是当我尝试时:
http://localhost:4000/foo
浏览器说:Cannot GET /foo
我的服务器代码:
var express = require('express');
var app = express();
var http = require('http');
var server = http .createServer(app);
var io = require('socket.io').listen(server);
var url = require('url');
server.listen(4000);
app.get('/', function (request, response) {
var pathname = url.parse(request.url).pathname;
console.log("currentpathname: "+pathname);
});
我想为:
http://localhost:4000/foo