How can I create admin route without adding custom or existing plugin?

System Information
  • Strapi Version:c5
  • Operating System: win10
  • Database: sqlite
  • Node Version: 20
  • NPM Version: 10
  • Yarn Version:

2 Likes

Did you check the admin customization’s documentation?

1 Like

@LuisAlaguna i checked documentation, I wouldn’t be asking if I found solution.

Also I have a weird issue with typescript custom plugin that it doesn’t generate admin route when I build project, I copied example for admin route from strapi documents.

1 Like

Which plugin is that? Is it using Turbopack?

1 Like

If anyone else is looking for solution,
at moment in Strapi V5 to add custom admin route without adding extra plugin, you can do it like this.

In following folder

src/extensions/user-permissions

create

strapi-server.ts

And inside you can add custom admin route like:

export default (plugin: any) => {
  plugin.routes["admin"].routes.push(
    {
      method: "GET",
      path: "/locations",
      handler: async (ctx: { body: any; query: any }) => {
        ctx.body = await strapi.documents("api::rental.location").findMany(ctx.query);
      },
    },
  ... //more routes
  );

  return plugin;
};