서버/Node.js
TypeError: Router.use() requires a middleware function but got a Object
sungho88
2019. 2. 6. 22:37
routes.js라는 파일에 라우터를 정의해두고,
app.js에서 import routes from './routes.js'로 사용했다
그런데 다음과 같은 에러가 발생했다.
typeerror: router.use() requires a middleware function but got a object
음 ..
router.use()는 미들웨어 기능이 필요하지만(요구되지만) Object가 있습니다?
뭔 말인가 찾아보다가..
export defalut routes;
가 없는 것을 발견했다. 이런;
추가해줬더니 에러 해결!
이런!
로 라우터를