Tell us what’s happening:
TypeError: Router.use() requires a middleware function but got a Object
What happened thus far:
I’ve cloned the github repo to my machine and I’ve ran npm i
to install dependencies. (Here I ran into a slight issue, since npm found vulnerabilities in old express packages and didn’t want to install it, so I’ve force-installed it with npm install express@4.14.0
)
Without adding additional code I’ve encountered the above-mentioned type-error. With many hours of research I cannot find how to resolve the issue.
What I’ve tried so far:
- replacing
const app = express()
toconst app = express.Router()
- moving the
module.exports = app
- messing with the
server.js
code
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Challenge Information:
Information Security with HelmetJS - Install and Require Helmet