Redesign and refactor HTTP API's static file handling
See original GitHub issueThe way HTTP API resources handle static files could be improved. Here is a list of issues to be addressed over time.
public routeStaticDirectory(
method: string,
path: string,
filePath: string,
contentType?: string) {
- Remove the
methodparameter. Anything other than “GET” doesn’t make sense for serving static files. (done in #26) - Provide a way to upload entire directories, not needing explicit file-by-file declarations.
- Enable regular expression captures, e.g. “/static/([^/]+)/(.)+” -> “/$1/$2”
- Compare the design with Rest, Heroku, GAE, and other providers. Ensure we have feature parity. (See #4 for reference.)
Related issues:
- Support “folders” in the Lumi layer (https://github.com/pulumi/pulumi-fabric/issues/240)
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (15 by maintainers)
Top Results From Across the Web
Building an ASP.NET Web API with ASP.NET Core - Toptal
ASP.NET Core is a leaner and more modular redesign of ASP.NET 4.x. Build a robust RESTful API using ASP.NET Core, EF Core, AutoMapper,...
Read more >Refactoring Towards Expressive REST APIs: Let Your Code ...
In this post, Pivotal Labs Engineering Manager, David Julia, provides an example of a problematic RESTful JSON API and an approach for ...
Read more >Automatically Generating Refactorings to Support API Evolution
Abstract. When library APIs change, client code should change in response, in order to avoid erroneous behavior, compilation failures, or warn-.
Read more >Refactoring Static File System Access | Blog - Ardalis
The first step in modifying this code to be unit testable is to create an abstraction to replace the file system operations being...
Read more >Code Refactoring Best Practices: When (and When Not) to Do It
Code refactoring is a process used in the DevOps philosophy that involves editing and cleaning up previously written code without changing ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Note that this last bullet is https://github.com/pulumi/pulumi-fabric/issues/153.
If you are suggesting that the
staticrouting do something unique to knowing what files are on disk in determining what routes it will wire up - that’s possible - but even further away from Express semantics (wherestaticis just middleware, and has no direct visibility in routing). And it doesn’t generalize at all into other routing.I think we should continue the discussion on #4 with a proposal on what it would mean to take a fundamentally different approach here that aligns deeply with Express. I’m very open to that - I’d feel much better if I had a high confidence approach that would get us there. And I don’t believe it’s impossible - I just don’t yet know how to do it yet. I’ll plan to do another pass at a strategy we could take that would get closer to Express semantics as part of 0.9.