error : Cannot GET /upload

tmcscoobydooTRIAL

a year ago

hey guys , please why when i deployed my express api to railway the post req is not working , it works as expexted from my localhost , but when i use railway url i get html res with this body

    <pre>Cannot GET /upload</pre>

only get res is working
this is some of my code maybe it helps :
const express = require("express");
require("dotenv").config();
const app = express();
app.use(express.json());
app.post("/upload", upload.single("file"), async (req, res) => {
try {
// Upload the file to the cloud
} catch (error) {
// console log the error and return status 500
}
});
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log("working!!");
});

Solved

2 Replies

a year ago

That's a total of 3 threads, do not open duplicate threads.

Make sure you are using https when you call your backend that runs on Railway.


Status changed to Solved railway[bot] about 1 year ago


tmcscoobydooTRIAL

a year ago

sorry about the others , i just tried to make the code prettier , and i didn't find how to delete them , and thanks , i forgot to add the 's' to http