Sign inSign up

cabsolutely/api2-driverpositionservice

By cabsolutely

Updated almost 10 years ago

This is a driver position service for Cabsolutely API2.0

Image
0

908

cabsolutely/api2-driverpositionservice repository overview

DriverPositionService

Driver position service for Cabsolutely API 2.0 - created with Odin

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: 'driver-position-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 coordinates = {
        latitude: 47.513853,
        longitude: 19.0553512
    };

    var driverPosition = {
        id: 'test1',
        coordinates: coordinates
    }

    service.postDriverPosition({
    	driverPosition: driverPosition
    }, function onResult(error, res) {
    	if (error) {
	    // Handle error
            return;
	}
        service.getDriverPositions({
            coordinates: coordinates
        }, function onResult(e, result) {
            if (e) {
                // Handle error
                return;
            }
            console.log(result);
        });
    });
}

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

290.8 MB

Last updated

almost 10 years ago

docker pull cabsolutely/api2-driverpositionservice