Showing posts from March, 2020

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(/). 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 /" If the message doesn't show even though you have a public folder (which was my case), try remove . aws-sam/build folder. At least it worked for my case. .aws-sam/build is recreated every time sam build is executed, so I use shell script removing the folder before sam local start-api.