##
#
# This is just a mock config file, describing what is needed to run the app
# The app currently only needs two paths / and /api
#
##

#
# This is needed to define any ports the app may use from node
#
upstream expressapp {
    server 127.0.0.1:3000;
    keepalive 8;
}

server {

    #
    # Needed to server up static, compiled JS files and index.html
    #
    location / {
        autoindex on;
    }

    #
    # define the api route to connect to the backend and serve up static files
    #
    location /api {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://expressapp;
        proxy_redirect off;
    }

}