강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của kunhyung08232801
kunhyung08232801

câu hỏi đã được viết

Node.js - Express

Tạo phần mềm trung gian Express

왜 에러가 뜰까요...

Viết

·

78

0

app.get('*',function(req, res, next){
  fs.readdir('./data', function(error, filelist){
    req.list = filelist;
    next();
  });
});

app.post('/create_process', (req, res)=>{
  console.log(req.list);
  var post = req.body;
          var title = post.title;
           var description = post.description;
          fs.writeFile(`data/${title}`, description, 'utf8', function(err){
             res.writeHead(302, {Location: `/?id=${title}`});
             res.end();
          })
});

이렇게 코드를 영상과 동일하게 작성했는데 왜 인지 모르게 자꾸 localhost:3000에서 튕기는데 그 이유를 도무지 모르겠습니다...

0|main | TypeError: Missing parameter name at 1: https://git.new/pathToRegexpError

0|main | at name (C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:73:19)

0|main | at lexer (C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:91:27)

0|main | at lexer.next (<anonymous>)

0|main | at Iter.peek (C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:106:38)

0|main | at Iter.tryConsume (C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:112:28)

0|main | at Iter.text (C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:128:30)

0|main | at consume (C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:152:29)

0|main | at parse (C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:183:20)

0|main | at C:\Users\kunhy\node_modules\path-to-regexp\dist\index.js:294:74

0|main | at Array.map (<anonymous>)

이렇게 오류가 나온다고 터미널에 뜨네요... 어떻게 해결해야할 지를 모르겠습니다


 

express

Câu trả lời

Câu hỏi này đang chờ câu trả lời
Hãy là người đầu tiên trả lời!
Hình ảnh hồ sơ của kunhyung08232801
kunhyung08232801

câu hỏi đã được viết

Đặt câu hỏi