Serves as name space for a collection of resources. i.e., api/v1, api/v2, etc
new (require("tastypie/lib/api"))(options [, serilaizer])
Provides namespaces for collections of resource ( api/v1, api/v2, etc )
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
options |
Object | api configuration options |
||
serilaizer |
module:tastypie/lib/serializer |
<optional> <nullable> |
null | A serializer instance to handle serialization / deserializion during the lifecycle of the request - rather than at the resource level. |
- Source:
Example
var api = new Api('api/v1'); x.use('fake', new Resource() )
Requires
- module:util
- module:boom
- module:debug
- module:mout/lang/isObject
- module:tastypie/lib/class
- module:tastypie/lib/class/options
Members
-
<readonly> urls
-
- Source:
Properties:
Name Type Description urls
Object An object containing all know methods registed to the api instance
Methods
-
<protected> normalizePath(path)
-
Normalizes a uri path by stripping trailing or adding leading slashed acordingly
Parameters:
Name Type Description path
String The path to normalize
- Source:
Returns:
The newly formated path
- Type
- String
-
use( [prefix], resource)
-
Mounts a resource on a route prefix
Parameters:
Name Type Argument Description prefix
String <optional>
The route prefix in addition the the API prefix
resource
module:tastypie/lib/resource A resource instance to mount at the prfix path
- Source: