-
Notifications
You must be signed in to change notification settings - Fork 68
Gateway
If you need to create a sub-folder which will display the resources of a physical folder or another server, you will need a way to tell the server that you manage the resource tree under in this folder.
To do so, you must create a resource and implement its optional method gateway
. This way, when the server will try to resolve a url (find a resource base on its path) and reach this resource, it will delegate the rest of the resolving to this resource (because it implements the gateway
method).
For instance, if the server is resolving the path /folder1/folder2/folder3/file.txt
and your gateway resource is at /folder1/folder2
, than, the server will handle until /folder1/folder2
and then delegate the rest to this resource, asking it to resolve /folder3/file.txt
.
If the gateway doesn't find the requested resource, it must return (through the callback) an Errors.ResourceNotFound
.
export interface IResource
{
gateway?(arg : MethodCallArgs, path : FSPath, callback : (error : Error, resource ?: IResource) => void)
}
Because the arg : MethodCallArgs
is an argument of this method, you can provide a different resource tree based on the request or the connected user.
You can find an example with the FTP Gateway and with the Physical Gateway.
- Home
- Version 2
- Install
- Quick Start Guide
- Examples
- Concepts
- User concepts
- Server concepts
- Customizing
- Version 1 [Obsolete]
- Install
- Quick Start Guide
- Examples
- Features
- Resource concepts
- User concepts
- Server concepts
- Customizing
- Project