server {
  listen 8080 default_server;

  root /usr/share/nginx/html;

  location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ /index.html;
  }

  location /api {
    rewrite ^/api/(.*) /$1 break;
    proxy_pass http://json-server:3000/api;
  }
  
  # Public api redirect
  location /base-adresse/base-adresse-nationale/streets {
    proxy_pass https://passerelle.formulaireextranet.grandlyon.com/base-adresse/base-adresse-nationale/streets;
  }

  location /geocoding/photon/api {
    proxy_pass https://download.data.grandlyon.com/geocoding/photon/api;
  }

   location /reverse {
    proxy_pass https://api-adresse.data.gouv.fr/reverse;
  }


  # REALLY important for JavaScript modules (type="module") to work as expected!!!
  location ~ \.js {
    add_header  Content-Type   text/javascript;
  }

}