var Service = require('Service');
var utils = require('utils');
var util = require('util');

/**
 * 列表
 */
var GetList = function() { 
  Service.call(this);
};

util.inherits(GetList, Service);

module.exports = GetList;

/**
 * 处理服务请求
 * @param  {Object} req 服务请求对象
 * @param  {Object} res 服务响应对象
 */
GetList.prototype.process =  function(req, res) {
  res.list = [];
  for(sid in server.bgServices) {
    var service = server.bgServices[sid];
    res.list.push({
      id: sid,
      name: service.name,
      path: service.path,
      isRunning: service.isRunning
    });
  }
  this.end(res);
};