Skip to content

normeno/simple-aws-sdk

Repository files navigation

Simple AWS SDK

Classes to make it easier to work with the AWS SDK

Examples

Initialize library

const saws = new SAWS();

// SQS
const sqs = saws.sqs(null, null, null, process.env.AWS_QUEUE_URL);

SQS

const queues = await sqs.listQueues()
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Get Queue url by queue name

const queues = await sqs.getQueueUrlByName(process.env.AWS_QUEUE_NAME)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Send a message to queue

const sendMessage = await sqs.sendMessage(message, groupId, deduplicationId)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Receive messages from queue

const receiveMessage = await sqs.receiveMessages(1, 60, 0)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Delete a message from queue

const deleteMessage = await sqs.deleteMessage(message.ReceiptHandle)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

About

Classes to make it easier to work with the AWS SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published