Reputation: 53
I have created a simple todo app for learning purposes. It is a full stack website that consists of a static html file with js script that is accessing api on the same host. Backend is build on node.js with express framework and mongodb. Everything works fine on a local server, that I start with cmd:
firebase serve --only functions,hosting
However when I deploy the app to the firebase cloud with cmd:
firebase deploy
I cannot access JSON file that should be served under /api/todos. Instead I receive 503 error:
The app/api/todos also does not work and gives error: Cannot GET /app/api/todos
I can access the file locally:
How can I access my JSON file after the deployment? How the route /app/api/todos would be translated in the app that is deployed?
Upvotes: 0
Views: 371
Reputation: 156
You should rewrite your /api route from hosting
to functions
in firebase.json
file
Take a look to this link
Upvotes: 2