This file contains 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
var http = require('http'); | |
var router = require('routes')(); | |
var Busboy = require('busboy'); | |
var AWS = require('aws-sdk'); | |
var inspect = require('util').inspect; | |
var port = 5000; | |
// Define s3-upload-stream with S3 credentials. | |
var s3Stream = require('s3-upload-stream')(new AWS.S3({ | |
accessKeyId: '', |
This file contains 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 file = this.input.files[0]; | |
//console.log(file); | |
var xhr = new XMLHttpRequest(); | |
xhr.addEventListener('load', (e) => { | |
console.log(e.target.response); | |
}); | |
xhr.open('POST', host + 'fileuploadstream', true); | |
xhr.setRequestHeader('body', JSON.stringify({ id: 'somebucketfolderid', fn: file.name })); | |
xhr.send(file); |
This file contains 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
// Lambda 1 - arv-foo | |
// Synchronous fn that will back API Gateway endpoint. | |
const AWS = require('aws-sdk'); | |
const lambda = new AWS.Lambda(); | |
const getRandomInt = (max) => Math.floor(Math.random() * Math.floor(max)); | |
exports.handler = async (event, context) => { | |
console.log("event:", event) |