https://itnext.io/run-your-containers-on-aws-fargate-c2d4f6a47fda
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 { google } = require('googleapis') | |
const axios = require('axios') | |
const firebaseServiceAccount = { | |
type: '', | |
project_id: '', | |
private_key_id: '', | |
private_key: '', | |
client_email: '', | |
client_id: '', |
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
{ | |
"configurations": [ | |
{ | |
"name": "Lambda", | |
"type": "node", | |
"request": "launch", | |
"runtimeArgs": ["--inspect", "--debug-port=9229"], | |
"program": "${workspaceFolder}/node_modules/serverless/bin/serverless", | |
"args": ["offline"], | |
"port": 9229, |
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 { ApolloServer, gql } = require('apollo-server-lambda') | |
const { resolvers } = require('../graphql/resolvers') | |
const responseCachePlugin = require('apollo-server-plugin-response-cache') | |
// Construct a schema, using GraphQL schema language | |
const typeDefs = gql` | |
type Query { | |
hello: String | |
} | |
` |
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
service: | |
name: <serviceName> | |
app: <serverless dashboard app name> | |
org: <serverless dashboard org name> | |
custom: | |
aws_profile: <aws profile> | |
warmup: | |
enabled: true | |
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
https://www.azurefromthetrenches.com/azure-functions-vs-aws-lambda-scaling-face-off/ | |
https://www.azurefromthetrenches.com/azure-functions-significant-improvements-in-http-trigger-scaling/ |
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
function createWebWorker (func) { | |
// Build a worker from an anonymous function body | |
const blobURL = URL.createObjectURL(new Blob(['(', | |
func.toString(), | |
')()'], { type: 'application/javascript' })) | |
const worker = new Worker(blobURL) |
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
export function runInSeries (funcs: Array<() => Promise<any>>): Promise<any> { | |
const results = [] | |
return funcs.reduce((accumulator, f) => accumulator.then(async () => { | |
const result = await f() | |
results.push(result) | |
return results | |
}), Promise.resolve()) | |
} | |
export function runInParallel (funcs: Array<() => Promise<any>>): Promise<any[]> { |
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 fs = require('fs'); | |
const pad = require('pad'); | |
fs.readFile('./package.json', 'utf8', (packageErr, packageJson) => { | |
const json = JSON.parse(packageJson); | |
const version = json.version; | |
const v = version.split('.'); | |
const versionCodeString = `${v[0]} ${pad(3, v[1], '0')} ${pad(4, v[2], '0')}`; | |
const versionCodeNumber = parseInt(versionCodeString.replace(/ /g, ''), 10); |
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
function _filterObjectByKeys (object, keys) { | |
console.log({ object, keys }) | |
return Object.keys(object).reduce((accum, key) => { | |
if (keys.includes(key)) { | |
return { ...accum, [key]: object[key] } | |
} else { | |
return accum | |
} | |
}, {}) | |
} |