Exemple #1
0
        public BootServicesModule()
        {
            Get["/boot/services"] = x => {
                var hostcfg = new HostConfiguration();
                var model   = new PageBootServicesModel {
                    Services = string.Join(Environment.NewLine, hostcfg.GetHostServices())
                };
                return(JsonConvert.SerializeObject(model));
            };

            Post["/boot/services"] = x => {
                string servicesText = Request.Form.Config;
                var    services     = servicesText.SplitToList(Environment.NewLine).Where(_ => !string.IsNullOrEmpty(_));
                var    hostcfg      = new HostConfiguration();
                hostcfg.SetHostServices(services);
                hostcfg.ApplyHostServices();
                return(HttpStatusCode.OK);
            };
        }