adobe / helix-cli

Command-line tools for developing with AEM
Apache License 2.0
51 stars 64 forks source link

provide cgi like actions #436

Closed tripodsan closed 5 years ago

tripodsan commented 5 years ago

as discussed during the 4/2018 hackathon, we should produce an ability to create cgi-like actions.

for example:

htdocs/cgi-bin/login.js

would be invoked with:

https://demo.project-helix.io/cgi-bin/login.js

/cc @davidnuescheler

trieloff commented 5 years ago

https://cq-dev.slack.com/archives/C9KD0TT6G/p1557392651377800

iven that the action and package name for src/html.htl is trieloff/2c5fbf40237634b75ba3ed821172dfc53b27a091/html, what should be action and package name for cgi-bin/html.js?

I'm seeing following options:

  1. trieloff/2c5fbf40237634b75ba3ed821172dfc53b27a091/html (i.e. allow conflicts)
  2. trieloff/2c5fbf40237634b75ba3ed821172dfc53b27a091/cgi-bin-html (inject prefix and hope to avoid conflicts)
  3. trieloff/2c5fbf40237634b75ba3ed821172dfc53b27a091-cgi-bin/html (create a new package to really avoid conflicts)
stefan-guggisberg commented 5 years ago
  1. or 3., with a soft pref for 2.
rofe commented 5 years ago

2

trieloff commented 5 years ago

Too late, 2 is already implemented.

trieloff commented 5 years ago

Use case: https://team.project-helix.io has a form that is currently an embedded google sheets iframe. With cgi-bin actions we can replace it with a proper contact form.

tripodsan commented 5 years ago

things to consider:

tripodsan commented 5 years ago

Too late, 2 is already implemented.

where?

trieloff commented 5 years ago

The build/deploy part of the implementation is in #851

cgi-bin needs special treatment in fastly, to allow POSTs (also see adobe/helix-pipeline#251)

Yes, there should be a new X-Request-Type = "CGI" to handle this.

if normal pipeline handles it, there will be a problem with POSTs as well.

No. The normal pipeline should remain GET only.

since the cgi-bin is not bound to a resource, it is quetionable if it should be handled by helix-pipeline... maybe for starters, we just treat them as raw openwhisk actions instead?

Yes, that was my plan. The helix-pipeline as it stands would only get in the way, so these are raw OW actions.

adobe-bot commented 5 years ago

:tada: This issue has been resolved in version 2.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

rofe commented 5 years ago

@trieloff can you add documentation and/or a quick code sample?

trieloff commented 5 years ago

Yes, as this becomes more practical to use. Right now, you can build and deploy the cgi-bin, but you cannot invoke it anywhere.