The Google Cloud documentation isn't very precise on the available syntax for the app.yaml file used for my Node.js application.
I used the syntax described in the Python documentation for GAE, from which I've found the handlers mecanism:
handlers:
- url: /index.html
static_files: /public/index.html
upload: /public/index.html
I've avoid my expressjs rule to serve the /public/index.html content and finally I got a 404 error, meaning GAE is not serving my page as a static content:
$ curl -i "http://my-project/index.html"
HTTP/1.1 404 Not Found
...
Do you have any clue on this? Node.js is relevant for making APIs, generating dynamic content... But I prefer using the Google backends or even a Nginx server to handle static contents.
Update
Removing the leading slashes didn't fixed the issue. I slightly changed my app.yaml configuration:
handlers:
- url: /api/.*
secure: always
script: app.js
- url: /.*
secure: always
static_dir: public
And I still get 404 Not found on /index.html
, and getting
the correct 200 OK answser when calling /api/stuff
.
Here is my project tree structure:
Project root
|- app.js
|- app.yaml
|- package.json
|- public/
| `-- css/
| `-- style.css
| `-- js/
| `-- main.js
| `-- index.html