Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.
Start by creating the SQS queue.
resource "aws_sqs_queue" "queue" {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EnrichmentBuilder { | |
| constructor(baseEvent) { | |
| this.baseEvent = baseEvent; | |
| this.enrichments = []; | |
| } | |
| addEnrichment({ name, value, type, data }) { | |
| const enrichment = { name, value }; | |
| if (type) enrichment.type = type; | |
| if (data) enrichment.data = data; |
The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.
However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const http2 = require('http2'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const zlib = require('zlib'); | |
| const brotli = require('brotli'); // npm package | |
| const PORT = 3032; | |
| const BROTLI_QUALITY = 11; // slow, but we're caching so who cares | |
| const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/'); | |
| const cache = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function doSomething() { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => resolve("done!"), 1000) | |
| }); | |
| } | |
| // Rejection case | |
| async function doSomethingBad() { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => reject("crap!"), 1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <graphml xmlns="http://graphml.graphdrawing.org/xmlns" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns | |
| http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> | |
| <key id="x" for="node" attr.name="x" attr.type="double"/> | |
| <key id="tooltip" for="node" attr.name="tooltip" attr.type="string"/> | |
| <key id="y" for="node" attr.name="y" attr.type="double"/> |