Wednesday, January 22, 2020

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


>PROBLEM

Running node.js/express application, returns error:

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


>SOLUTION

Go to the router files and check if module.export sttm is present.
Example:

module.exports = router;

>ENV

node.js v12.4.0
Express
Windows 10


No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...