-
Notifications
You must be signed in to change notification settings - Fork 39
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
Using interfake as middleware for connect #6
Comments
To clarify, are you imagining the interfake instance being completely set up as part of your gruntfile and then used as part of the test environment? Or rather, providing the interfake methods as part of the test environment? |
Hi, your first idea is what I mean. I'm using grunt-contrib-connect to serve frontends on my local machine. I would like a connect middleware to fake REST APIs but I don't want to configure interfake inside the Gruntfile (since this tends to get big). Let me add to my previous code sample:
var Interfake = require('Interfake')
, interfake = new Interfake();
interfake.createRoute({...});
module.exports = interfake;
connect: {
options: {
port: 8080,
hostname: 'localhost'
},
test: {
options: {
middleware: function (connect) {
return [
require('./myInterfakeInstance').asMiddleware()
];
}
}
}
}, |
Ah, I see. Okay, I'll look into this at some point if someone doesn't get here first - I imagine it's not too hard to do. I suppose there are some hooks so that we can start and then stop the server at the appropriate moments? |
Cool! The connect server can be started with Grunt: grunt.registerTask('devserver', ['connect:server:keepalive']); |
It would be nice to use interfake in a Grunt setup as a connect middleware like this:
The text was updated successfully, but these errors were encountered: