inflearn logo
강의

講義

知識共有

Node.js - Express

Expressミドルウェアの作成

왜 에러가 뜰까요...

92

kunhyung08232801

投稿した質問数 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

29

1

map API

0

50

1

nodejs 터미널 인식

0

54

1

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

0

118

2

학습 방향성

0

93

1

넥스트 버젼 질문

0

90

2

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

0

104

1

오류 이유

0

63

0

에러

0

339

0

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

0

458

0

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

0

517

3

Passpot.js

0

259

0

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

0

357

0

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

0

233

0

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

0

263

0

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

0

346

0

수료증!

0

259

0

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

0

279

1

sanitizeHtml을 쓰면....

0

293

1

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

0

280

1

pm2 사용법,,

0

679

1

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

1

243

0

0

361

2

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

0

315

1