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; //})); }
public FileResource(ResourceHandlerScheme scheme, string domain, string wwwroot) : base(scheme, domain) { this.wwwroot = wwwroot; }
public static Bootstrap UseFileResource(this Bootstrap _, ResourceHandlerScheme scheme, string domain, string basePath) { Bootstrap.RegisterCustomResourceHandler(() => new FileResource(scheme, domain, basePath)); return(_); }
public AssembledResource(Assembly assembly, ResourceHandlerScheme scheme, string domain, string wwwroot = null) : base(scheme, domain) { resourceAssembly = assembly; this.wwwroot = wwwroot; }
public static Bootstrap UseAssembledResource(this Bootstrap _, Assembly assembly, ResourceHandlerScheme scheme, string domain, string basePath = null) { Bootstrap.RegisterCustomResourceHandler(() => new AssembledResource(assembly, scheme, domain, basePath)); return(_); }