Static file serving #7

Closed
dbrain opened this Issue Jun 3, 2012 · 1 comment

Projects

None yet

1 participant

@dbrain
Owner
dbrain commented Jun 3, 2012

As somebody from the past, I'd like to be able to serve static files to a user without writing my own io code, probably from a set directory, with some funkiness around what headers are sent back so the files can be cached.

@dbrain dbrain was assigned Jun 3, 2012
@dbrain dbrain added a commit that referenced this issue Jun 5, 2012
@dbrain #7 Add static file serving middleware 1b9d778
@dbrain
Owner
dbrain commented Jun 5, 2012

This is done, as middleware.

// Capture requests for /mountpoint/static and look for files in CWD/public
server.Use(soggy.NewStaticServerMiddleware("/static"))
// Change default static path
server.Config.SetStaticPath("notPublic")

If file is not found or a directory it will continue to the next middleware (hitting 404 handlers or your own route starting with /static).

@dbrain dbrain closed this Jun 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment