Allow "connect-like" object to be passed to grunt-express as the "server" #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow "connect-like" object to be passed to grunt-express as the "server" rather than just a string.
This allows for grunt to pass configuration to the server, such as things from grunt.option or whatever it desires, and then build out the server and pass back the ready-object.
My use case for this is that I am building a grunt plugin which performs client-side unit testing. This plugin consumes grunt-express to start a localhost web server which generates the HTML pages for the tests. I want to pass in the list of dependencies for each test file to the web server from Grunt, or at least the paths where the test files live which are configured in the user's Gruntfile.js - currently there is no way for me to pass data to the server.js from grunt-express.
An example of how to use this:
Gruntfile.js
testEnvironment.js - grunt task consuming grunt-express
server.js
Currently there would be no way to pass configuration to the server prior to it starting. This allows that to happen. There are existing hooks to pass in middleware from grunt, but no way to do more advanced configuration. This allows the system to be a lot more robust.