Here is my Gruntfile.js
:
module.exports = function(grunt) {
grunt.registerTask('start', function () {
var http = require('http');
http.createServer(function (req, resp) {
resp.writeHead(200, {'Content-Type': 'application/json'});
resp.end('{status: 1}');
}).listen(1337, '127.0.0.1');
});
};
So when I run grunt start, there is no effect and listen
doesn't work.
If I move this code from Gruntfile to separate server.js
and run it standalone, it works fine.
Is there any way to make Grunt wait for the http process?