Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default index file for static directory #512

Closed
wants to merge 1 commit into from

Conversation

terrywarwar
Copy link

*Issue #437

Default page index.html for static directory. localhost:3000 -> serves index.html

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sanathkr
Copy link
Contributor

Hey @terrywarwar Thanks for sending this PR! Actually, this feature is already supported. Checkout https://github.com/awslabs/aws-sam-cli#static-assets

This PR actually is not the solution for the issue #437. Root cause of this issue is different.

If the solution I gave you works, this PR won't be necessary. Let me know.

@sanathkr sanathkr added the blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days label Jun 28, 2018
@terrywarwar
Copy link
Author

Hi @sanathkr The static-assets work when I specify a page to load, but It doesn't serve the index.html by default for root path /, I get Missing Authentication Token

@sanathkr
Copy link
Contributor

If you have an index.html at the root of the folder that is pointed by --static-dir, then it will serve index.html from there. You just need to adjust the folder to cover all the files you want.

I am not saying this is a perfect solution. SAM CLI's support for static websites can be improved. I created #523 for this purpose.

This Pull Request, unfortunately, is not accurate. sam local start-api is meant to start the Serverless backend (API+Lambda) but not really for the index.html or frontend resources. Untill #523 is solved, A better strategy would be to use a simple Node server or other tools start your web server to serve frontend resources, and use SAM CLI just for your backend.

In this light, this PR is not accurate. I am going to close this. Feel free to continue the discussion in #523.

@sanathkr sanathkr closed this Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants