Skip to content

Instantly share code, notes, and snippets.

View nmiguelmoura's full-sized avatar

Nuno Machado nmiguelmoura

  • Porto, Portugal
View GitHub Profile
@nmiguelmoura
nmiguelmoura / template.yaml
Last active March 18, 2021 09:51
AWS Api Gateway to SQS integration (path parameters to SQS)
# POST endpoint /update/{productId}.
# Api Gateway will send the productId to an SQS Queue.
AWSTemplateFormatVersion: 2010-09-09
Description: >-
api-to-sqs
Transform:
- AWS::Serverless-2016-10-31
@nmiguelmoura
nmiguelmoura / template.yaml
Last active December 23, 2022 08:02
AWS Api Gateway to SQS integration (request.body to SQS)
# POST endpoint /update with a JSON payload like {"products": ["123", "456"]}.
# Api Gateway will send this payload to an SQS Queue.
AWSTemplateFormatVersion: 2010-09-09
Description: >-
Api Gateway as a proxy to SQS.
Transform:
- AWS::Serverless-2016-10-31
@nmiguelmoura
nmiguelmoura / service-worker.js
Last active May 15, 2019 09:37
An exemple of a service worker that always tries to fetch results, fallbacking to cache only if theres a fetch error.
const CACHE_VERSION = 'cache_version_1';
self.addEventListener('install', (event) => {
console.log('service worker install');
if(!caches in self) {
return;
}
event.waitUntil(