Better HN
topnewbestaskshowjobs
Log inSign up

breandr

2 karma · joined Mar 1, 2015 (11y ago) · 6 submissions

Submissions

1.

So long API Gateway, and thanks for all the routes(codegenie.codes ↗)

2 points · by breandr · 2y ago · discuss

comment 9y ago · link · parent

https://github.com/awslabs/aws-serverless-express

comment 9y ago · link · parent

You need to specify your MIME type (most commonly, application/json) to be treated as binary (from console: API -> Binary Support). In your Lambda function: `callback(null, { body: base64EncodedBody, status: 200, headers: {}, isBase64Encoded: true })`

comment 10y ago · link · parent

Hi Everhusk, I don't specifically call it out in the article, but the code is actually reusing database connections. As mentioned in other comments, the trick is to establish the connection outside of the handler so that the connection only happens once per container.

comment 10y ago · link · parent

Check out our example on github https://github.com/awslabs/aws-serverless-express/tree/maste.... The lambda wrapper is very thin (4 LOC). So you have two options: run/test your express app locally as you always would, or use the provided `npm run local` command which simulates the API Gateway+Lambda part (you can modify the `api-gateway-event.json` to change the "request" from API Gateway). This is primarily an example and starting point, and there is much more you could do to improve this process.

comment 11y ago · link · parent

Hello, this is certainly off-topic but I am curious about your username. Is it in reference to Waldorf schools? My daughter just started preschool at one and I'm wondering if "notwaldorf" is a shot at Waldorf schools. As a parent I would obviously love to know about any negative experiences.