Skip to content

Commit

Permalink
chore: omit the readme code example
Browse files Browse the repository at this point in the history
  • Loading branch information
abetomo committed Dec 17, 2021
1 parent 6e62b33 commit f7d4f70
Showing 1 changed file with 6 additions and 57 deletions.
63 changes: 6 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,9 @@ const sqs = (() => {
})
})()

// Once you create the sqs instance, you do not need to modify any other code.
const queueUrl = 'https://sqs.us-east-1.amazonaws.com/xxx/test'

// sendMessage
try {
const params = {
QueueUrl: queueUrl,
MessageBody: 'hoge' + (new Date()).toString()
}
const sendRes = await sqs.sendMessage(params).promise()
console.log('+++\n%s\n+++', JSON.stringify(sendRes, null, ' '))
} catch (err) {
console.error(err)
}

// receiveMessage
let message = null
try {
const params = { QueueUrl: queueUrl }
message = await sqs.receiveMessage(params).promise()
console.log('===\n%s\n===', JSON.stringify(message, null, ' '))
} catch (err) {
console.error(err)
}

// deleteMessage
try {
const params = {
QueueUrl: queueUrl,
ReceiptHandle: message.Messages[0].ReceiptHandle
}
const delRes = await sqs.deleteMessage(params).promise()
console.log('---\n%s\n---', JSON.stringify(delRes, null, ' '))
} catch (err) {
console.error(err)
}
//
// do something
//
```

### Starting http server
Expand Down Expand Up @@ -116,27 +83,9 @@ try {
console.error(err)
}

// receiveMessage
let message = null
try {
const params = { QueueUrl: queueUrl }
message = await sqs.receiveMessage(params).promise()
console.log('===\n%s\n===', JSON.stringify(message, null, ' '))
} catch (err) {
console.error(err)
}

// deleteMessage
try {
const params = {
QueueUrl: queueUrl,
ReceiptHandle: message.Messages[0].ReceiptHandle
}
const res = await sqs.deleteMessage(params).promise()
console.log('---\n%s\n---', JSON.stringify(res, null, ' '))
} catch (err) {
console.error(err)
}
//
// do something
//

if (process.env.LOCAL_TEST === '1') {
// !!! Finally shutdown the server
Expand Down

0 comments on commit f7d4f70

Please sign in to comment.