Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aneldev/dyna-tiny-url-service

Dyna Node Service for Tiny URLs
https://github.com/aneldev/dyna-tiny-url-service

Last synced: 1 day ago
JSON representation

Dyna Node Service for Tiny URLs

Awesome Lists containing this project

README

        

# Dyna Tiny Url Service

Dyna Node Service that makes a URL tiny using the tinyurl.com api.

# Usage example

```
// our server
const server = new DynaNodeServer({
addresses: {
internal: 'n/localhost/57206',
external: 'n/localhost/57206',
},
connectionIds: {
'dyna-tiny-url': {
encryptionKey: 'encryptionKey',
accessKey: 'accessKey',
},
},
});
await server.start();

// This is our Tiny URL Service
const service = new DynaTinyUrlService({
name: "Dyna Tiny URL Service",
serverDynaNodeAddress: 'n/localhost/57206',
serviceConnectionId: 'dyna-tiny-url',
encryptionKey: 'encryptionKey',
accessKey: 'accessKey',
});
await service.start();

// Our Client
const client = new DynaNodeClient();

// Let's ask it!
client.sendReceive({
to: 'dyna-tiny-url@n/localhost/57206',
command: COMMAND_TinyURL_Get,
args: null,
data: {
url: 'http://www.anel.co/example/long/path/long/path/long/path/long/path/long/path/long/path/long/path/long/path',
}
})
.then(reply => {
console.log('shorten url:', reply.data.tinyUrl);
console.log('qr barcode:', reply.data.qrBarcode);
});

```

See it in action running the test of this package.