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

Serving Dynamic HTML how to add JS and CSS files #32

Closed
dohomi opened this issue Dec 12, 2016 · 3 comments
Closed

Serving Dynamic HTML how to add JS and CSS files #32

dohomi opened this issue Dec 12, 2016 · 3 comments
Labels

Comments

@dohomi
Copy link

dohomi commented Dec 12, 2016

Hello,

I followed your examples on how to set the response to HTML. Now I am wondering how would I add CSS and JS to the HTML output? I was spinning my head around and tried some S3 alternatives but they are all not working on serverless 1.x

Thanks

@nikgraf
Copy link
Contributor

nikgraf commented Dec 12, 2016

@dohomi just static CSS & JS I would host via cloudfront or use tools like netlify or surge.sh. Have you seen this example? https://github.com/serverless/examples/tree/master/aws-node-single-page-app-via-cloudfront

@dohomi
Copy link
Author

dohomi commented Dec 16, 2016

Hi @nikgraf thanks I successfully got this working. One question is bothering me now: I use internal VueJs to render subroutes. As soon the user is routing to a subroute and reloads the page, for sure the connection to the endpoint is gone. Is it possible to configure serverless, that the endpoint is listening to all incoming request like:

functions:
  vueLanding:
    handler: handler.vueLanding
    events:
      - http:
          method: get
          path: landing-page/** // is this somehow possible?

Where would I need to forward all requests to my endpoint? I would like to run my serveress endpoint as a webserver which serves the HTML of a small internal NodeJS framework based on Vue SSR. Thanks

@nikgraf
Copy link
Contributor

nikgraf commented Jan 15, 2017

Yes, you can set wildcards like we did for the REST API example: https://github.com/serverless/examples/blob/master/aws-node-rest-api-with-dynamodb/serverless.yml#L49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants