app.get(['/:id'], function (req, res) {
var _url = req.url
console.log(url.parse(_url,true));
const pages = fs.readdir('pages', function (err, files) {
let pathname = req.params;
console.log(pathname.id);
console.log(pathname);
console.log(files);
console.log('Automotive Design.html'== files[2] );
console.log(__dirname+'/pages/'+pathname.id);
if(true){
res.sendFile(path.join(__dirname+'/pages/'+pathname.id));
}else{
res.writeHead(404);
}
// res.sendFile(path.join(__dirname,'pages',''+pathname.id));
});
当我在此URL http://localhost:12345/Automotive%20Design.html中运行此代码时,意外地发现了另一个名为“icon”的ID值,我希望找到它并将其删除。
1条答案
按热度按时间x8diyxa71#
这两个是结果。