A Web Server task similar to Python's SimpleHTTPServer, with Cross-Origin Resource Sharing and No-Cache options.
A Web Server task for grunt similar to Python's SimpleHTTPServer, with Cross-Origin Resource Sharing and No-Cache options.
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-web-server --save-dev
In your project's Gruntfile, add a section named
web_server to the data
object passed into
Please take special note of the
foo: "bar" property below. For some reason an extra key with a non-object value is necessary for things to work. Clearly I'm not understanding something about writing a Grunt plugin here... would appreciate a pull or note if anyone knows what I'm doing wrong.
gruntinitConfigweb_server:options:cors: trueport: 8000nevercache: truelogRequests: truefoo: 'bar' // For some reason an extra key with a non-object value is necessary
Whether to send Cross-Origin Resource Sharing headers.
What port to server web requests on.
If true, then the server will send headers to try to force the browser to request files afresh each time.
If true, then the server will log all incoming requests and the HTTP status of their result.
Once you've configured the web server as above, run the web server with:
Terminate the web server with
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.