본문 바로가기
TIL/Node.js

TIL D-09 throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))

by 홍차23 2020. 1. 14.

에러:

throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))
      ^

TypeError: Router.use() requires a middleware function but got a Object

 

해결방법:

//api.js 파일에 아래 코드 추가

module.exports = router;

 

참고:

https://stackoverflow.com/questions/27465850/typeerror-router-use-requires-middleware-function-but-got-a-object

댓글