github.com/golazy/golazy@v0.0.7-0.20221012133820-968fe65a0b65/lazydev/NOTES.md (about)

     1  
     2  The server start and listens to a port:
     3  
     4  That will be long lived.
     5  
     6  If the backend works, it will serve from the backend.
     7  If the backend does not work, it will serve from the frontend.
     8  
     9  
    10  # Requirements
    11  
    12  * If it does not compile it should show the error message.
    13  * Once it compiles, it should display the page instantly.
    14  
    15  How to do that?
    16  
    17  # Listening http in parent and conditionally forwarding to child
    18  on an http request:
    19  
    20  if backend.running: proxy request.
    21  if backend.not handle request.
    22  
    23  *Cons*: child runs on http
    24  
    25  
    26  
    27  # Listening socket and forward everything to child
    28  
    29  *Cons*: If child does not work, nothing works.
    30  
    31  
    32  # Parent and child share the same listener. Parent is only enable if the client compiles. 
    33  
    34  *Pros:* Client have a real socket and request is not forwarded
    35  *Cons:* Parent can't respond to requests.
    36  
    37  # Parent only listens the tcp socket. Clients does everything. The client compiles, and if it works, it creates a new child and let the previous one dies
    38  
    39  How does the parent wait the new child?
    40  
    41  
    42  # Parent only listens and starts/restart the client on fs changes.
    43  
    44  How does the parent display compilation errors?
    45  
    46  
    47  
    48  
    49  A) Child handles HTTP (No response when down)
    50  B) Parent handles HTTP (Ugly proxy)
    51  C) Parent handles HTTP only when child is dead (More complex)
    52