-2

这是我的代码

var express = require('express');
var fs = require('fs');
var config = JSON.parse(fs.readFileSync("./config.json"));
console.log(config);
var host = config.host;
var port = config.port;

var app = express.createServer();

// use route
app.use(app.router);

// for static files this location
app.use(express.static(__dirname));

// root path
app.get('/', function (request, response) {

    response.send("hello");
});


app.get("/id/:id", function (request, reponse) {


    var value = request.params.id;
    console.log(value);
    response.send(value.toString());

});

app.listen(port, host);

我可以在 url 127.0.0.1:3317/id/hello中记录 id 之后的任何值

Hello 打印在控制台中,但出现ReferenceError: response is not defined 错误。

请帮帮我

4

1 回答 1

22

response是拼写错误的response

于 2013-08-03T03:56:20.203 回答