初入nodejs,被一个题困惑了,求解答
发布于 7个月前 作者 backsapce 327 次浏览

此题来自nodeschool第二个教学模块Stream Adventure,这个题是第七题HTTP SERVER 题目的要求是把通过浏览器POST进来的内容直接输出给浏览器

我的实现如下

var server =  http.createServer(function(req,res){
  if(req.method == 'POST'){
    req.pipe(tr).pipe(res);
  }else{
    res.end('please send a post request');
  }

});
server.listen(Number(process.argv[2]));
\n```

但很可惜通不过测试

ACTUAL                             EXPECTED
------                             --------
"YET"                              "YET"                         
"HOW"                              "HOW"                         
"TO"                               "TO"                          
"BURGEON."                         "BURGEON."                    
"IT'S"                             "IT'S"                        
"MEANT"                        !== "MILLIEMS"                    
"YET"                          !== "MEANT"                       
"HOW"                          !== "OF"                          
"TO"                           !== "MILLIEMS"                    
"BURGEON."                     !== "CENTIMENTS"                  
"IT'S"                         !== "OF"                          
"MILLIEMS"                     !== "DEADLOST"                    
"MEANT"                        !== "CENTIMENTS"                  
"OF"                           !== "OR"                          
"MILLIEMS"                     !== "DEADLOST"                    
"CENTIMENTS"                   !== "MISLAID"                     
"OF"                           !== "OR"                          
"DEADLOST"                     !== "ON"                          
"CENTIMENTS"                   !== "MISLAID"                     
"OR"                           !== "THEM"                        
"DEADLOST"                     !== "ON"                          
"MISLAID"                      !== "BUT,"                        
"OR"                           !== "THEM"                        
"ON"                           !== "MASTER"                      
"MISLAID"                      !== "OF"                          
"THEM"                         !== "BUT,"                        
"ON"                           !== "MASTER"                      
回到顶部