vibe.d: How to get the conent of a file upload ?
    Adam D. Ruppe 
    destructionator at gmail.com
       
    Sun Sep 20 02:04:07 UTC 2020
    
    
  
On Sunday, 20 September 2020 at 01:51:22 UTC, wjoe wrote:
> Would even be more awesome if it provided a function which 
> could be called from a custom main on top of the FancyMain.
> I find e.g. custom parsing of command line arguments incredibly 
> useful.
Yea, the version 2.0 stuff inside cgi.d does that. You can call 
`cgiMainImpl` from your own main thing (that's all the mixin does 
anyway) and disaggregate it as much as you want.
I was improving that this week when the baby decided to come, so 
the rest will be coming a little later. But on my copy right now 
you can even break up cgiMainImpl because its implementation is:
---
void requestHandler(Cgi cgi) {
    // if you call cgi.dispatcher in here, it does basically
    // what the old FancyMain would do, going to a class.
}
void main(string[] args) {
         alias CustomCgi = Cgi; // just normal class w/o more 
custom
         if(tryAddonServers(args))
                 return;
         if(trySimulatedRequest!(requestHandler, CustomCgi)(args))
                 return;
         RequestServer rs;
         rs.listeningPort = 3000; // if you want to change default
         rs.configureFromCommandLineArguments(args);
         rs.handleRequests!(requestHandler, CustomCgi)(); // this 
may never return
}
---
But I haven't pushed this live yet. Probably will write about it 
in the blog next week or the week after depending on how 
everything else irl goes. Still not 100% happy with it, but a big 
goal with my version 2.0 implementation here is to make more 
pick-and-choose customization possible while still using the 
automation in the places you want that.
    
    
More information about the Digitalmars-d-learn
mailing list