EkaSe / CoffeeToCode

0 stars 0 forks source link

Exploring dynamic pages: pre-build executables #4

Closed acrm closed 6 years ago

acrm commented 6 years ago

Our first step to dynamic pages was some generated html, inserted in the content of each html file, that will be requested. It's may be fine for some very general logic, like debugging, but what if we want some more page-specific logic, like greeting an authorized visitor on index page, authorizing visitors on login page and loading saved drawings on canvas page? Dumping all these different logics into single middleware - bad idea. Splitting these logics to several independent middlewares, one per html file - a little bit better, but still has such flaws, as two different files: static html and dynamic middleware for one logical page. The solution might be using pre-build excecutable: just simply a C# console application that output generated html code. For example, when user is requesting an index.html page, middleware runs index.exe application, catch it's output to stream and returned it as http response.

acrm commented 6 years ago

Actually the idea was to make it more simply: generator app generate html not by reading some static file and inserting some dynamic info, but by simple Console.WriteLine("<html>...") ; and etc. Also, there is not need to output html to another file, that will be read by Middleware, because we can read in Middleware directly from the processe's OutputStream. Now let'smake it this way, so we will have only one file for each dynamic page: executable generator. This will help us on the next steps.

EkaSe commented 6 years ago

@acrm Actually it won't be a single file anyway, I'll need all this directory with all this dll-hell except for Index.html, or a few dll's and configs in case of framework-dependent deployment. So I'll do it but it's not going to be much simpler :)

acrm commented 6 years ago

It's ok, there might be more then one output file, like supportive dll, but there is only one source file, which contains both static and dynamic content.