inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

Node.js - Express

Express 미들웨어 만들기

왜 에러가 뜰까요...

88

박건형

작성한 질문수 2

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

답변 0

몽고 db 접속 오류

0

22

1

map API

0

41

1

nodejs 터미널 인식

0

43

1

미들웨어 체인 구현 보다가 생긴 궁금증에 대해 질문 드려요!

0

111

2

학습 방향성

0

85

1

넥스트 버젼 질문

0

83

2

로그인시 401 Unauthorized 오류가 뜹니다

0

94

1

오류 이유

0

58

0

에러

0

334

0

lowdb모듈을 찾을 수 없다고 뜹니다

0

454

0

이거 node3 시리즈 강의 처음부터 보고 있었는데

0

501

3

Passpot.js

0

254

0

"express-session의 session 객체" 시간 표시 오류

0

355

0

"express-session의 옵션" 유투브 링크가 잘 못되어 있어요.

0

229

0

main.js 소스중 일부 log, logout_process 소스가 빠져있어 부탁드립니다.

0

261

0

혹시 완성 코드본은 없을 까요 ㅜㅜ

0

344

0

수료증!

0

255

0

이메일 입력하면 제출이 안됩니다..

0

274

1

sanitizeHtml을 쓰면....

0

288

1

host:3000에 들어가지지 않습니다 ㅠㅠ

0

277

1

pm2 사용법,,

0

676

1

세션 미들웨어 설치 링크가 잘못되어 있는것 같습니다.

1

241

0

0

358

2

새로운 챕터를 시작할때마다 소스코드를 제공해 주시기 바랍니다.

0

309

1