Question

Dynamic routing and app platform

Hey there, I’m trying to solve a 404 error that I’m receiving when calling an API I built. It seems that it has to do with App Platform not working with dynamic routing, but I’m looking to see if there’s a solution for this that I’m missing or what not.

The Idea

/api/zip/{{zipcode}}

The Problem Receiving Cannot GET /12345

Here’s my current configuration:

- github:
    branch: project-name
    deploy_on_push: true
    repo: repo/project-name
  instance_count: 1
  http_port: 3001
  instance_size_slug: basic-xxs
  name: express-server
  run_command: 'node server/index.js'
  routes:
  - path: /api/zip/
  source_dir: /

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @lewisadam1992,

App Platform supports dynamic routing and the ‘Cannot GET /path’ error usually occurs due to the configuration issues. It would be difficult to figure out the exact reason for the failure without looking at the code.

Here are some links that might be helpful: https://stackoverflow.com/questions/9627441/cannot-get-with-connect-on-node-js https://stackoverflow.com/questions/50629652/strange-create-react-app-heroku-error-cannot-get

If the issue persists, I’d request you to raise a support ticket to us so that we can have a closer look on the same.

Cheers, Taha Fatima