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:
| /** | |
| * Assuming your app.arc includes: | |
| * @plugins | |
| * test-plugin | |
| * | |
| * This file would live in `src/plugins/test-plugin/index.js` or `src/plugins/test-plugin.js` | |
| */ | |
| // let { join } = require('path') | |
| module.exports = { |
| // 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() |
| // 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() |
| // 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>` | |
| } | |
| } |
| test('can list cats', async t=> { | |
| t.plan(1) | |
| let result = await data.cats.scan({}) | |
| t.ok(result, 'got result') | |
| console.log(result) | |
| }) |
| 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) | |
| }) |
| 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') | |
| }) |
| 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', |
| // src/http/get-index/index.js | |
| exports.handler = async function http(request) { | |
| return { | |
| type: 'text/html', | |
| body: 'Hello world!' // 200 status by default | |
| } | |
| } |
I hereby claim:
To claim this, I am signing this object: