Hello, I have followed the example through in the book, but for chapter 5 I get the following error
'TypeError: Router.use() requires middleware function but got a Object'
this is associated wit the changes in 'Breaking out the sendfile endpoint'
e.g.
app.use('/', require('./controllers/static'))
I have also tried app.use('/', require('./controllers/static')) - same error
Note: app.use(require('./controllers/api/posts')) works fine
I looked at the downloadable zip file for chapter5 but this is not the same, it uses ejs to provide views, this is not the same as the book. (It has also introduced Morgan too)
At this stage, I would rather not include another dependency (ejs) and just have this work as intended defined in static.js, can you please help ?
Hello, I have followed the example through in the book, but for chapter 5 I get the following error 'TypeError: Router.use() requires middleware function but got a Object'
this is associated wit the changes in 'Breaking out the sendfile endpoint' e.g. app.use('/', require('./controllers/static')) I have also tried app.use('/', require('./controllers/static')) - same error Note: app.use(require('./controllers/api/posts')) works fine
I looked at the downloadable zip file for chapter5 but this is not the same, it uses ejs to provide views, this is not the same as the book. (It has also introduced Morgan too)
At this stage, I would rather not include another dependency (ejs) and just have this work as intended defined in static.js, can you please help ?