-
Notifications
You must be signed in to change notification settings - Fork 26
Serving PNG images #6
Comments
Please could you create a small github repo so that I can see how you were trying to send the file? |
Please find the issue replicated here, the code is almost same as in the article. https://github.com/traversals-analytics-and-intelligence/image-serve-issue-node10-express-template/tree/issue-showcase But with Please let me know your comments. |
@alexellis any advice? |
I'm finding the examples quite confusing. What is the goal? Just to serve static content without having any function or API? Alex |
In the example, yes. The goal is to have a function dedicated to serving only static content, similar to your article. I will try to explain my code better. |
The handler provides the image as string here and that is sent in the index Please refer the stackoverflow for context. I have branched the code with a quick change to show when serving images work. When dealing with a file, if the When dealing with static files, the handler should provide on the path and Express also provides a builtin in static middleware. Please let me know if I wasn't clear enough. Thanks. |
adding the line, |
I will take some time to look into this, but exposing express is not a goal of the function template. Would you find it useful to have a template which just gave you the Alex |
Thanks. I understand that exposing express is not a goal of the template. If I get |
Hi, I was trying to use this template to serve SPA files. I was following the article https://www.openfaas.com/blog/serverless-single-page-app/ . It works well except for images and I suspect for contents such as pdf. I tried modifying the template to use express'
sendFile()
and setting the rightContent-Type
and it works with that. However, I was not able to succeed sending files with eitherend()
orpipe()
. If there is an alternative without modifying the template, please let me know. Based on the suggestion, I can also make a pull request to correct the issue. Thanks in advance.The text was updated successfully, but these errors were encountered: