Google Cloud App Engine app.yaml basic usage

229 views Asked by At

Google's app.yaml doc provides examples but lacks the example of very simple basic usage in: https://cloud.google.com/appengine/docs/php/config/appconfig#PHP_app_yaml_Static_file_pattern_handlers

Say I have app.yaml in the same directory as an html file (eg cat.html) which basically plays an audio from a wav file (eg catsound.wav) also in the same directory, what should the basic app.yaml file be? The html file say is:

<!DOCTYPE html>
<html>
<body>
<audio controls>
  <source src="catsound.wav" type="audio/wav">
Your browser does not support the audio element.
</audio>
</body>
</html>

The users would only go to .appspot.com. There is no sub url. Why wouldn't the following app.yaml work to upload both cat.html and catsound.wav?:

application: kat
version: 1
runtime: php
api_version: 1
handlers:
- url: /.*
  static_files: cat.*
  upload: cat.*

What should the right app.yaml for this so basic an example be?

1

There are 1 answers

3
Peter McKenzie On

You need to map the URL to a static file using a back-reference, e.g. \1. I imagine you want something like this assuming everything is in your application's root directory (warning: I haven't tested this):

- url: /(.*)
  static_files: \1
  upload: cat.*