Grunt grunt-contrib-connect
grunt-contrib-connect
grunt-contrib-connect is
stand alone grunt task server.
This is used for testing static contents and javascript using simple server.
How to use
This is required grunt-task. If you aren’t familiar with grunt, please see Grunt(other entry).
package.json
"devDependencies": { "grunt": "~0.4.5", "grunt-contrib-connect": "*" } }
Add grunt-contrib-connect
Gruntfile.js
module.exports = function(grunt) { grunt.initConfig({ connect: { local: { options: { keepalive: true, port: 8000 } } } }); grunt.loadNpmTasks('grunt-contrib-connect'); };
Run
grunt connect
In nodejs
Unfortunately, this works only static contents(included javascript)
Nodejs express routing doesn’t work.
public/index.html
<html> <body> Hello, World! </body> </html>
You can access
http://localhost:8000/public/index.html
Ref
grunt-contrib-connectで簡易サーバーを用意する
gruntjs/grunt-contrib-connect