Пример #1
0
        public static Bootstrap UserRestfulService(this Bootstrap _, ResourceHandlerScheme scheme, string domain, Action <RestfulService.RestfulServiceProvider> provider = null)
        {
            Bootstrap.RegisterCustomResourceHandler(() =>
            {
                var resourceHandler = new RestfulServiceResource(scheme, domain);

                provider?.Invoke(RestfulService.RestfulServiceProvider.Create(resourceHandler));

                return(resourceHandler);
            });
            return(_);
        }
        public RestfulServiceResource(ResourceHandlerScheme scheme, string domain)
            : base(scheme, domain)
        {
            //RouteCollection.Add(new Route(Method.None, "controller/info", (request) =>
            //{
            //    var info = @"{""message"":""Welcome to NanUI!""}";

            //    var response = new FormiumResponse()
            //    {
            //        MimeType = "application/json",
            //        ContentStream = new System.IO.MemoryStream(Encoding.UTF8.GetBytes(info)),

            //    };

            //    response.Headers["Access-Control-Allow-Origin"] = new string[] { "*" };

            //    return response;
            //}));
        }
Пример #3
0
 public FileResource(ResourceHandlerScheme scheme, string domain, string wwwroot)
     : base(scheme, domain)
 {
     this.wwwroot = wwwroot;
 }
Пример #4
0
 public static Bootstrap UseFileResource(this Bootstrap _, ResourceHandlerScheme scheme, string domain, string basePath)
 {
     Bootstrap.RegisterCustomResourceHandler(() => new FileResource(scheme, domain, basePath));
     return(_);
 }
Пример #5
0
 public AssembledResource(Assembly assembly, ResourceHandlerScheme scheme, string domain, string wwwroot = null)
     : base(scheme, domain)
 {
     resourceAssembly = assembly;
     this.wwwroot     = wwwroot;
 }
Пример #6
0
 public static Bootstrap UseAssembledResource(this Bootstrap _, Assembly assembly, ResourceHandlerScheme scheme, string domain, string basePath = null)
 {
     Bootstrap.RegisterCustomResourceHandler(() => new AssembledResource(assembly, scheme, domain, basePath));
     return(_);
 }