How do I host HTML on Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

Aditya Joon : Hello, how can I host HTML on pipedream

Dylan Sather (Pipedream) : Hi , can you tell me a little more about your use case? Do you want to host a form where users can enter data that triggers a workflow, for example?

Aditya Joon : I am doing a CTF which requires a bot to visit my website and post some hints, so i have the html code where the bot could come and do that, i just need a place to host the code, so I was wondering if i could do that on pipedream

Dylan Sather (Pipedream) : Great thanks. Pipedream is not purpose-built for hosting websites, so you may get more mileage using tools like Vercel or Netlify (for example). Then the form submission on the site can initiate an HTTP POST request that triggers the Pipedream workflow.

But for simple use cases you can host HTML on Pipedream by using the $respond function: https://pipedream.com/community/t/how-do-i-send-a-custom-http-response-from-a-workflow-step/955/3?u=dylburger . If you choose the HTTP API trigger, and include code like that in a workflow, any HTTP request to your endpoint will return that HTML.

Since you have access to the HTTP method of the incoming request, you can also conditionally respond with HTML only when a GET request is made. When POST requests are made, you could instead process the incoming payload. That allows a single Pipedream workflow to both host the HTML and process its data.

Since you can run any Node.js code, truly anything is possible, but I hope that gives you some general guidance. Let me know if that helps!

Aditya Joon : Thanks a lot Dylan, I appreciate it.