routes/index.js
const allRoutes = express()
allRoutes.get("/", async (req, res, next) => {
return res.status(200).json({
title: "Express Testing",
message: "The app is working properly!",
})
})
allRoutes.use("/auth", authRoutes)
allRoutes.use("/user", userRoutes)
allRoutes.use("/product", productRoutes)
allRoutes.use("/order", orderRoutes)
export default allRoutes
api/index.js
import allRoutes from "../routes/index.js"
app.use("/api/v1", allRoutes)
After trying to deploy MERN app to vercel, the backend route only can run allRoutes.get("/")
and other routes showed that This Serverless Function has timed out.
. I could not figure out why will the function has timed out but vercel is working properly so I would like to look for a suggested solution to fix the problem
I followed the deployment guide step by step in Vercel documentation but still had error occurred at last