Sign inSign up

cabsolutely/api2-settingsservice

By cabsolutely

Updated almost 10 years ago

This is settings service for Cabsolutely API2.0

Image
0

843

cabsolutely/api2-settingsservice repository overview

SettingsService

Settings service

Running the process

make start

This starts your application on port 9000.

Usage

To use this service, you will need Befrost. Here is an example:

var Befrost = require('befrost');

var config = {
    serviceName: 'somecompany@settings-service',
    hostPortList: ['127.0.0.1:21300'],
    timeout: 5000,
    secretKey: 'secret_key'
};

var client = Befrost(config, onConnected);

function onConnected(err, service) {
    if (err) {
        // Handle error
        return;
    }
    
    var setting = {
        type: 'testType',
        key: 'testKey',
        valueType: 'testValueType',
        value: 'testValue'
    };
    service.postSetting({
    	setting: setting
    }, function onResult(error, res) {
    	if (error) {
	        // Handle error
	        return;
	    }
	    console.log(res);
    });
}
Structures
  • ServiceType:
    • type (string): The setting type. Required.
    • key (string): The unique key of a setting. Required.
    • valueType (string): The type of the value. Required.
    • value (string): The value of a setting. Required.
    • id (string): The id of an element. Not required.
Functions

All response has an "ok" boolean property, which shows if the request has succeeded, and a "body" property, which contains the actual data.

  • getSetting(id): Returns with a setting with the given id.
  • getSettings(query, skip, limit): Returns with a setting array from those that matches the given filter.
  • postSetting(serviceType): Posts a setting. Returns with the setting's id.
  • putSetting(id, serviceType): Updates a setting with the given id. Returns with the setting's id.
  • deleteServiceType(id): Deletes a setting with the given id. Returns null.

NPM scripts

  • npm test This will run the tests.
  • npm run view-cover This will show code coverage in a browser

Contributors

  • Balazs Fabian

Tag summary

Content type

Image

Digest

Size

281.4 MB

Last updated

almost 10 years ago

docker pull cabsolutely/api2-settingsservice