When "sam local start-api" does not mount public folder as "/"...
With aws-sam-cli, I've been experiencing public folder is not mounted as root(/).
.aws-sam/build is recreated every time sam build is executed, so I use shell script removing the folder before sam local start-api.
For example, if we have ./public/index.html file, it should be accessed as "http://localhost:3000/index.html" after
# sam local start-api
(You doesn't have to have -s or --static-dir option if public folder is OK for you)
To make it work
- Make sure you have the public folder.
- confirm Following message on the screen, "Mounting static files from /api/sam-app/public at /"
.aws-sam/build is recreated every time sam build is executed, so I use shell script removing the folder before sam local start-api.
Comments