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
require('dotenv').config(); | |
const express = require('express'); | |
const app = express(); | |
const cors = require('cors'); | |
const bodyParser = require('body-parser'); | |
const { Storage } = require('@google-cloud/storage'); | |
const multer = require('multer'); | |
const port = process.env.API_PORT || 8080; | |
app.use(bodyParser.json()); |
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
module.exports.requestUploadURL = (event, context, callback) => { | |
var s3 = new AWS.S3(); | |
var params = JSON.parse(event.body); | |
var s3Params = { | |
Bucket: 'slsupload', | |
Key: params.name, | |
ContentType: params.type, | |
ACL: 'public-read', | |
}; |
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
// this is my aws serverless function | |
const serverless = require('serverless-http'); | |
const express = require('express'); | |
const AWS = require('aws-sdk'); | |
const app = express(); | |
app.use(express.urlencoded({ extended: true })); |