0

I am trying to set up a vue.js application with the vue router set in "history" mode. I also want to serve my back end APIs from the same app engine application. (e.g., if a user navigates to /some/path/in/the/app and refreshes the page or shares the link, the application will display the expected page)

here is my app.yaml:

runtime: python37

handlers:
  - url: /api/.*
    secure: always
    script: auto

  - url: /css
    static_dir: www/css

  - url: /js
    static_dir: www/js

  - url: /semantic
    static_dir: www/semantic

  - url: /img
    static_dir: www/img

  - url: /
    static_files: www/index.html
    upload: www/index.html

  - url: /.*
    static_files: www/index.html
    upload: www/index.html

When I try to hit any of my api endpoints, the static index.html file is served instead of the response from the endpoint.

If the last route is omitted (url: /.*), then the api endpoints are served correctly, but the Vue.js app can only be entered from the "/" route and the deep links in the application do not work as expected

I am not looking to have a script in my application to serve the a static file.

note, this question is similar, but none of the answers addressed my situation:

Fisch
  • 3,775
  • 1
  • 27
  • 38

1 Answers1

0

The trick was to follow a microservice architecture and split my application into two modules and define the routes in a dispatch.yaml file.

There is a sample project here:

Fisch
  • 3,775
  • 1
  • 27
  • 38