Getting 404, for new method in extension/users-permission (custom login api)

System Information
  • Strapi Version: 4.1.1
  • Operating System: macOS
  • Database: Postgres
  • Node Version: 16.14.2
  • NPM Version: 8.5.0
  • Yarn Version:

I am trying to create a custom login page api where the api from strapi will serve to other applications as endpoints.

So i was referring to and followed all the steps.

  1. created a file /extension/users-permission/strapi-server.js
  2. place the new route and function in the file
    but it still returns 404, without consoling anything.

However the ‘newMethod’ shows up in admin board of strapi and I have given it public access
please assist, I am new to strapi.
I tried searching on forum, applied few methods but nothing seems to work.

probably chances are your controller implementation (user.newMethod) not returning anything or you have not defined controller implementation for route.

Hi Nitish

Don’t know if you still have the issue.
I just encountered it myself.

Here’s what you can do:

  • set ctx.body with your response:
ctx.body = { "hello": "world" }
  • set ctx.status with the response status:
ctx.status = 204

The status doesn’t need to be set if ctx.body is set and you want it to be the usual 200 status

Best regards

I’m currently having this issue. Did you solve it? @Nitish_Kumar