Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requiring files with incorrect paths inside config/server.js fails silently #268

Open
davemo opened this issue May 21, 2014 · 0 comments
Open

Comments

@davemo
Copy link
Member

davemo commented May 21, 2014

When using config/server.js and the apiProxy feature to stub out API's it can be useful to put those stubs in a separate directory/file to avoid clogging up server.js. When a require statement fails to locate a path, due to a typo or non-existent file, api stubbing and proxying fails silently and express starts throwing 404's.

I'm thinking this may have something to do with watch_r being used to monitor the server.js file for changes and re-evaluate it but haven't dug into why this is.

We should see if we can make things explode loudly when requires fail in this manner.

ie:

var session = require('./stubs/PATH-with0-TYPO.js');

module.exports = {
    drawRoutes: function(app) {
        app.get('/api/session', function(req, res) {
            res.json(session);
        });
    }
};
curl -XGET http://localhost:8000/api/session
404 Not Found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant