daviddripps / dripps-express-mvc

yet another approach to MVC in Express/Connect
3 stars 1 forks source link

SyntaxError: Unexpected identifier #2

Closed aleksandrmelnyk closed 12 years ago

aleksandrmelnyk commented 12 years ago

First load page is broken, then following call page is ok, but in console always following error:

SyntaxError: Unexpected identifier at Object.Function (unknown source) at Object.compile (/home/mamay/projects/adageo/node_modules/jade/lib/jade.js:160:8) at Function.compile (/home/mamay/projects/adageo/node_modules/express/lib/view.js:68:33) at ServerResponse._render (/home/mamay/projects/adageo/node_modules/express/lib/view.js:417:18) at ServerResponse.render (/home/mamay/projects/adageo/node_modules/express/lib/view.js:318:17) at handleError (/home/mamay/projects/adageo/node_modules/dripps-express-mvc/index.js:37:32) at Object.oncomplete (/home/mamay/projects/adageo/node_modules/dripps-express-mvc/index.js:70:28)

aleksandrmelnyk commented 12 years ago

Seems this to be caused by trying to call getStylesheets(). After installing the mvc module, I got server error for static files. like css. GET http://127.0.0.1:3000/stylesheets/style.css 500 (Internal Server Error)

aleksandrmelnyk commented 12 years ago

app.use(express.static(__dirname + '/public')); should be define before app.use(app.router); app.use(mvc.middleware); this solves problem with static files.

But there is still issue with "Cannot GET /" on first request to default page.

daviddripps commented 12 years ago

thanks for the info. I've updated the git repo and will update the NPM package shortly.

daviddripps commented 12 years ago

@mamayoleksandr the issue you're seeing in the console is due to my lack of experience with Jade in the views for 404 and 500 pages. They've been fixed. The issue of the first request failing still persists and I will be working on it today. Thanks again for the report.

metacatdud commented 12 years ago

move app.use(mvc.middleware); above app.use(express.static(__dirname + '/public'));

daviddripps commented 12 years ago

Thanks @metacatdud I tested your suggestion and it works! I've updated the Git repo and will push a new version to NPM shortly.