How can I setup a grunt task to run my express server?

I don't need something like grunt-express as that seems to hijack too many options and make too many assumptions. All I really want to do is be able to do coffee server.coffee from Grunt and have that run until some process ends. Can someone point me to a way to be able to do this?

Specifically, I'm running selenium first, then I need to run my server, then I need to run my protractor tests, then I need to end the selenium server, then I need to end my server.

Thanks!

You can use nodejs child_process to run command in grunt and async series if you want to do tasks in series

For example (without async)

grunt.registerTask('doTask', 'do a single task', function() {
  var exec = require('child_process').exec;

  var runCmd = function(item, options, callback) {
        process.stdout.write('running "' + item + '"...\n');
        var cmd = exec(item, options);
        cmd.stdout.on('data', function(data) {
            grunt.log.writeln(data);
        });
        cmd.stderr.on('data', function(data) {
            grunt.log.errorlns(data);
        });
        cmd.on('exit', function(code) {
            if (code !== 0) throw new Error(item + ' failed');
            grunt.log.writeln('done\n');
            callback();
        });
   });

   runCmd('npm install', {cwd: '../server'}, function(err, results){
    // do sth
  });
});

With async

 grunt.registerTask('doTasks', 'run tasks in series', function() {
    var async = require('async');
    var exec = require('child_process').exec;
    var done = this.async();
    //process.env.NODE_ENV = 'production';
    var runCmd = function(item, options, callback) {
        process.stdout.write('running "' + item + '"...\n');
        var cmd = exec(item, options);

        cmd.stdout.on('data', function(data) {
            grunt.log.writeln(data);
        });
        cmd.stderr.on('data', function(data) {
            grunt.log.errorlns(data);
        });
        cmd.on('exit', function(code) {
            if (code !== 0) throw new Error(item + ' failed');
            grunt.log.writeln('done\n');
            callback();
        });
    };
    async.series({
        "do task 1": function(callback) {
            runCmd('npm install', {
                cwd: ''
            }, callback);
        },
        "task 2": function(callback) {
            runCmd('grunt', {
                cwd: ''
            }, callback);
        },
        "task3": function(callback){
            runCmd('grunt', {
                cwd: ''
            }, callback);
        }
    }, function(err, results) {
        if (err) done(false);
        done();
    });
});