Skip to content

Instantly share code, notes, and snippets.

@richardgrantserverless
Created May 20, 2022 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardgrantserverless/bd6d23b019d9e3fcdff85623ce2f52e5 to your computer and use it in GitHub Desktop.
Save richardgrantserverless/bd6d23b019d9e3fcdff85623ce2f52e5 to your computer and use it in GitHub Desktop.
import { resizeHandler } from "./resizeHandler";
export const handler = async event => {
try {
const imagePath = await resizeHandler.process(event);
const URL = `http://${process.env.BUCKET}.s3-website.${
process.env.REGION
}.amazonaws.com`;
return {
headers: { location: `${URL}/${imagePath}` },
statusCode: 301,
body: ""
};
} catch (error) {
console.log(error);
return new Error(error);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment