-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Static assets #76
Static assets #76
Conversation
@@ -66,6 +67,11 @@ func main() { | |||
Usage: "Optional logfile to send runtime logs to", | |||
}, | |||
cli.StringFlag{ | |||
Name: "static-dir, s", | |||
Usage: "Any static assets (e.g. CSS/Javascript/HTML) files located in this directory will be presented at /", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you eloborate what /
refers to? Something like "mounted at /
of API gateway URL"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments. Feel free to ignore if you think it is not necessary.
|
||
// Mount static files | ||
if c.String("static-dir") != "" { | ||
public, err := getWorkingDir(baseDir, c.String("static-dir"), checkWorkingDirExist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename public
variable to static
for consistency
log.Printf("WARNING: Could not mount static files: %s\n", err) | ||
} else { | ||
fmt.Fprintf(os.Stderr, "Mounting static files from %s at /\n", public) | ||
router.PathPrefix("/").Handler(http.FileServer(http.Dir(public))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
people might ask for a static path prefix override real soon.
Merging this now to cut a new release. |
Implements new
--static-dir
CLI flag that defaults topublic/
.Fixes #41