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

Templates for static fileserver and redirect #898

Merged
merged 3 commits into from
Nov 22, 2022

Conversation

itowlson
Copy link
Contributor

@itowlson itowlson commented Nov 14, 2022

This depends on #889 (and currently includes it; I'll rebase once we've agreed whether that's the way to go and have merged whatever comes out of the discussion).

At the moment the component references refer to test releases in my forks. I will update these when we do formal releases.

ivan@hecate:~/testing/compytest$ spin add static-fileserver statto
HTTP path: /assets
Directory containing static assets to serve: assets

ivan@hecate:~/testing/compytest$ spin add redirect au-revoir
Redirect from: /au-revoir
Redirect to: /goodbye

ivan@hecate:~/testing/compytest$ spin up
Serving http://127.0.0.1:3000
Available Routes:
  hello: http://127.0.0.1:3000/hello
  goodbye: http://127.0.0.1:3000/goodbye
  statto: http://127.0.0.1:3000/assets (wildcard)
  au-revoir: http://127.0.0.1:3000/au-revoir

@itowlson
Copy link
Contributor Author

spin templates list output after installing these:

+----------------------------------------------------------------------------+
| Name                    Description                                        |
+============================================================================+
| bartholomew             Web site using Bartholomew micro-CMS               |
| http-c                  HTTP request handler using C and the Zig toolchain |
| http-empty              HTTP application with no components                |
| http-go                 HTTP request handler using (Tiny)Go                |
| http-grain              HTTP request handler using Grain                   |
| http-rust               HTTP request handler using Rust                    |
| http-swift              HTTP request handler using SwiftWasm               |
| http-zig                HTTP request handler using Zig                     |
| redirect                Redirects a HTTP route                             |
| redis-go                Redis message handler using (Tiny)Go               |
| redis-rust              Redis message handler using Rust                   |
| static-fileserver       Serves static files from an asset directory        |
| testing-custom-filter                                                      |
+----------------------------------------------------------------------------+

Wondering if static-fileserver should be static-file-server or just fileserver? #BikeshedTime

@itowlson itowlson marked this pull request as ready for review November 22, 2022 01:35
Copy link
Member

@mikkelhegn mikkelhegn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have only review the template metadata.


[parameters]
http-path = { type = "string", prompt = "HTTP path", default = "/static/...", pattern = "^/\\S*$" }
asset-path = { type = "string", prompt = "Directory containing static assets to serve", default = "assets", pattern = "^\\S+$" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to change this to "files-path" with a prompt "Directory containing the files to serve."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done - thanks!

Signed-off-by: itowlson <ivan.towlson@fermyon.com>
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants