Serverless + GraphQL + SVG Talk code example
This is all the code from my November 2019 talk at Trending.JS.
Here's what you should look at if you want to recreate something like this:
- serverless.yaml: All the AWS Lambda config is in this. You'll need to tweak this to deploy
- data.js: This is the GraphQL data handler for Serverless. It consumes mock data from data.json; normally you'd make requests to an API instead.
- chart.js: This is the chart handler. It takes one path parameter,
config, to fork between the
advancedchart examples (both in
- /charts: The actual chart generation code.
basic.jsreturns a simple SVG string.
advanced.jsuses JSDOM + D3 to create a more realistic example.
- schemas.js: GraphQL schemas. I've made these really trivial by design.