Nodejs routing problem for app service

James Christopher D. Corpuz 0 Reputation points
2024-01-21T15:50:51.8033333+00:00

I recently uploaded an existing node express application that I made to azure app service. I have encountered routing problems that wasnt present before when I was just using portforwarding and through localhost. I have also added web.config file to my code but the problem still exists. When going to /login I am getting a /get request error.

// ---------------------------------------------------------- //
// Routes                                                     //
// ---------------------------------------------------------- //
const router = express.Router();

app.get('/', (req, res) => {
  return res.send("Smart Extension API");
});

	return res.send("API starts here");
});

app.use('/login', pseudoLogin);
app.use('/user', userRoutes);
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,261 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Konstantinos Passadis 19,376 Reputation points MVP
    2024-01-21T19:49:54.4966667+00:00

    Hello @James Christopher D. Corpuz !

    Could you please share the Browser - Inspect Output ?

     Go to your Web Application - Find the CORS Setting and add * for the Allowed Origins

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.