79245962

Date: 2024-12-03 00:38:09
Score: 1
Natty:
Report link

It looks like either your server.js is not deployed to your prod environment correctly, or the router for the events endpoints is not registered correctly. You can try to temporarily add the routes for events and tasks to a single router object in e.g. events-and-tasks.js, prefixing endpoints accordingly (you can also change the base path temporarily to e.g. api2 so you can make sure that the update got deployed successfully):

events-and-tasks.js:

const express = require("express")
// ...

const router = express.Router()

router.get("/events", async (req, res) => {
  // ...
})

router.get("/tasks", async (req, res) => {
  // ...
})

module.exports = router

server.js

const routes = require("./routes/events-and-tasks");
app.use("/api2", routes);

If /api2/events and /api2/tasks both work, there is something going on with how the two separate routers are added. I would check a few more things in this case:

  1. If you add the tasks router first and the events router second, does that fix the events endpoint and break the tasks endpoint?
  2. Is there any difference in the backend project setup between the dev and prod environments? (It would be helpful if you described your deployment workflow.)
  3. Clear your browser cache and try again, just in case.
Reasons:
  • Blacklisted phrase (1): Is there any
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Gabor Dicso