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 
  1. Make sure you have the public folder.
  2. 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.

Comments

Popular posts from this blog

Subclassing and Signal connect on a same widget crashes PySide application on exit.

Showing CPU/Memory usage on tmux status bar(tmuxのステータスバーにCPUとMemoryの使用状況を表示する)

Calling OpenCV functions via Cython from Python 3.X.