events {

}
http {
    # set aliases
    upstream app_server {
        server host.docker.internal:3000;
    }
    upstream app_2_server {
        server host.docker.internal:3001;
    }
    upstream shared_server {
        server host.docker.internal:3002;
    }
    upstream shared_server_2 {
        server host.docker.internal:3003;
    }

    server {
        listen 80;
        #server_name _;
        # /app2 will serve the client for app2, and any client can call the api by calling /app2/api
        location /app2 {
            proxy_pass http://app_2_server;
        }
        # We need to set app2 to have a different pkg directory, and to forward on that.
        location /pkg2 {
            proxy_pass http://app_2_server;
        }
        # /api_shared will call the server functions registered on shared_server
        location /api_shared {
            proxy_pass http://shared_server;
        }
        # /api_shared_2 will call the server functions registered on shared_server_2
        location /api_shared2 {
            proxy_pass http://shared_server_2;
        }
        # we will by default serve the client for app-1
        location / {
            proxy_pass http://app_server;
        }
    }
}