I hereby claim:
- I am ryanblock on github.
- I am ryanblock (https://keybase.io/ryanblock) on keybase.
- I have a public key whose fingerprint is 14F0 9ABC 90E5 7F55 0690 0056 6C27 888B 0369 8554
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// src/http/get-index/index.js | |
exports.handler = async function http(request) { | |
return { | |
type: 'text/html', | |
body: 'Hello world!' // 200 status by default | |
} | |
} |
const fs = require('fs') | |
const join = require('path').join | |
exports.handler = async function http(req) { | |
let module = req.params.module | |
let filePath = join(__dirname, 'node_modules', '@architect', 'views', module) | |
let exists = fs.existsSync(filePath) | |
if (exists) { | |
let file = fs.readFileSync(filePath).toString() | |
return { | |
type: 'text/javascript; charset=utf8', |
let arc = require('@architect/architect') | |
let data = require('@architect/data') | |
let tiny = require('tiny-json-http') | |
let test = require('tape') | |
let end // save a ref | |
test('start sandbox', async t=> { | |
t.plan(1) | |
end = await arc.sandbox.start() | |
t.ok('started sandbox') | |
}) |
test('can get /', async t=> { | |
t.plan(1) | |
let url = 'http://localhost:3333' | |
let result = await tiny.get({url}) | |
t.ok(result.body, 'got a 200 response') | |
console.log(result.body) | |
}) |
test('can list cats', async t=> { | |
t.plan(1) | |
let result = await data.cats.scan({}) | |
t.ok(result, 'got result') | |
console.log(result) | |
}) |
// This function is everything you need to build a Lambda-based app with Begin | |
exports.handler = async function http(req) { | |
return { | |
type: 'text/html; charset=utf8', | |
body: `<h1 class="center-text">Hello world!</h1>` | |
} | |
} |
// I like using dotenv locally but that's up to you | |
require('dotenv').config() | |
const aws = require('aws-sdk') | |
const path = require('path') | |
const fs = require('fs') | |
const series = require('run-series') | |
const waterfall = require('run-waterfall') | |
const requestTemplate = fs.readFileSync(path.join(__dirname, 'node_modules', '@architect', 'architect', 'src', 'create', 'aws', 'create-http-route', 'create-route', '_request.vtl')).toString() | |
const requestFormPostTemplate = fs.readFileSync(path.join(__dirname, 'node_modules', '@architect', 'architect', 'src', 'create', 'aws', 'create-http-route', 'create-route', '_request-form-post.vtl')).toString() | |
const requestBinary = fs.readFileSync(path.join(__dirname, 'node_modules', '@architect', 'architect', 'src', 'create', 'aws', 'create-http-route', 'create-route', '_request-binary.vtl')).toString() |
As it turns out, most normal humans are incapable of learning to use Twitter @ replies. And in case you don't follow me on Twitter: yes, my handle (@ryan) gets a lot of erroneous mentions. (The most amusing, random ones I've even taken to retweeting under the #wrongryan hashtag.)
Then Tweetbot -- and its ability to use regex as Twitter filters -- came along. Here's how the Tapbots guys and some regular expressions single-handedly made my Twitter replies usable again.
Notes and caveats
expression{3,}
) are buggy. So everything below should work without crashing Tweetbot for iPhone, iPad, and Mac.// I like using dotenv locally but that's up to you | |
// require('dotenv').config() | |
const aws = require('aws-sdk') | |
// eslint-disable-next-line | |
let logs = [ | |
// Insert your logs here, eg '/aws/lambda/begin-production-foo', | |
] | |
const cloudwatchlogs = new aws.CloudWatchLogs() |