var system = require("../../../system")
const http = require("http")
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");


var cacheBaseComp = null;
class RouteCtl extends CtlBase {
  constructor() {
    super("common", CtlBase.getServiceName(RouteCtl));
    this.appS=system.getObject("service.common.appSve")
  }
  async create(p,q,req){
    let appid=p.app_id;
    let apptmp= await this.appS.findById(appid)
    let routedata={
      name:p.name,
      hosts:p.shosts.split(","),
      paths:p.spaths.split(","),
      isstrip:false,
      app_id:appid,
      shosts:p.shosts,
      spaths:p.spaths
    }
    let rtn=  await this.service.create(apptmp.name, routedata, req);
    return system.getResult(rtn)
  }
}
module.exports = RouteCtl;
