Live Demo: https://adc6qwtnce.execute-api.us-east-1.amazonaws.com/tutorial/
YouTube: demo
This is the 'hello world' example of Autodesk Forge Viewer deployed to AWS-Lambda... aka 'Serverless'.
To simplify deploy to AWS-Lambda, I use 'Claudia.js'. The backend stack is Node.js / Express.
Below I demonstrate 'Claudia.js' 'update' command to re-deploy a small html code change. Claudia handles the task of zipping, uploading and re-wiring node.js endpoints to 'AWS-Lambda & API-Gateway' automatically.
Before you start, make sure you have npm and AWS credentials setup.
- Run
npm install
- Run
npm run create
to send everything up to AWS Lambda. It will return a 'new URL'. - Edit the file
package.json
and update the variablesFORGE_CLIENT_ID=xxx,FORGE_CLIENT_SECRET=xxx,FORGE_URN=xxx
with your own Forge values. - Run
npm run setvars
to push the environment variables to Lambda. - Open the 'new URL' in a browser
Example: https://adc6qwtnce.execute-api.us-east-1.amazonaws.com/tutorial/
Remember to add a '/' or a '/index.html' to the URL.
- Make a code change to file
'www/index.html'
- Run
npm run update
... It output a 'new URL' - Open the 'new URL' in a Browse to see your changes.
Make sure LINE#38 in app.js is commented out
- Uncomment line 38, in app.js
- Add your Forge Environment variables. Similar to this...
export FORGE_CLIENT_ID=lDB........0Ol
export FORGE_CLIENT_SECRET=f...H
export FORGE_URN= dXJu........QucnZ0
- start the server with ...
> node app.js
- Open
localhost:3000/
in a browser - Make some code changes
This code came from GITHUB-Express-Lambda
More information on Express/Serverless can be found here: Running Express Apps in AWS Lambda
The package.json was modified from here: Package.json
Inspired by this blog post, by Philippe Leefsma.