A Storage Service combines an Application Service and a User Storage for storage based services. A Storage Service also includes the definition of Item and Item.Fields to describe the structure of data that it will be using with the storage.
Storage Service supports everything an Application Service does and also has Origin definitions for a number of User Storage Functions.
Create a new instance of a Storage Service by calling the Server.NewStorageService() function. This function requires a ServiceDefinition argument which describes the service and a ServiceDefaults argument which describes the configuration settings and their default values.
exports.Construct =
function Construct( Server )
{
let service = Server.NewStorageService( Server, ServiceDefinition, ServiceDefaults );
...
return service;
}
This returns a StorageService object:
StorageService = {
name: '', // The name of the service. Must be a "safe" name.
title: '', // Title for display in UIs.
description: '', // Description for display in UIs.
Item: { // Service Item Definition
name: '', // Programmatic name for the item. (UserPost)
title: '', // Readable title for the item. (User Post)
titles: '', // Readable title for multiples. (User Posts)
description: '', // Description of the item.
shareable: false, // Shareable flag enables sharing functions.
Fields: [], // Array of Field definitions for the item.
},
Origins: {}, // Map of service functions.
Views: {}, // Map of service pages.
};