79191694

Date: 2024-11-15 09:16:06
Score: 0.5
Natty:
Report link

Just a quick check you can do on your axios request :

When creating an api with NestJS it come with the globalPrefix variable like this :

app.setGlobalPrefix(globalPrefix); // <= This variable
const port = process.env.NX_RC_PUBLIC_API;
const hostname = '0.0.0.0';
await app.listen(port, hostname);
Logger.log(
   `🚀 Application is running on: http://${hostname}:${port}/${globalPrefix} | Version : ${process.env.VERSION}`
  );

Did you check you don't forget to add this to your request ?

When generating with NX for exemple the most common is "api" so you request should look like :

const response = await axios.post('http://localhost:3000/api/naptime/create', createNapTimeDto);
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Driftminder