我用的Express,我是下边这么写的
var express = require('express');
var app = express();
app.delete('/del_user', function (req, res) {
console.log("/del_user 响应 DELETE 请求");
res.send('删除页面');
})
var server = app.listen(8081, function () {
var host = server.address().address
var port = server.address().port
console.log("应用实例,访问地址为 http://%s:%s", host, port)
})
我打开127.0.0.1:8081/del_user总是得到Cannot GET /del_user,却不能得到删除页面,求大侠,这是为什么呢??
Enter the URL in the browser address bar, and the browser will request the server in the form of GET, but your program does not have the logic to handle GET. To send a DELETE request, you can find a RESTClient tool to test the effect.
Write a form and change the submission type to delete
curl -X DELETE localhost:3000/del