jdx / mean-sample

Sample project for Write Modern Web Apps with the MEAN Stack by Jeff Dickey
https://mean-sample.herokuapp.com
166 stars 90 forks source link

Chapter 5 - TypeError: Router.use() requires middleware function but got a Object #42

Open daniel-cullen opened 8 years ago

daniel-cullen commented 8 years ago

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 ?