changing the route name /admin in my next js vercel project

default discord avatar
BrandonMager10 months ago
4

Hi, I have a next js vercel project where I used npx next-payload install to extend payload to my project. I know you can do /admin to go to the page and login. However, is there a way to assign a different route name instead of /admin? Thanks.

  • default discord avatar
    notchr10 months ago

    Good morning @BrandonMager - you can customize the built-in routes on your Payload config object.



    The config in

    payload.config.js

    has a "routes" property that accepts an object



    For example, one I use on a personal project



      routes: {
        api: "/payload/api",
        admin: "/payload/admin",
        graphQL: "/payload/graphql",
        graphQLPlayground: "/payload/graphql-playground",
      },


    Let me know if tht answers you question, happy to help

  • discord user avatar
    seanzubrickas
    9 months ago

    Hey @BrandonMager did you have a chance to try the above suggestion? Let us know if you have any follow up questions here. Thanks!

  • default discord avatar
    BrandonMager9 months ago

    Hey @seanzubrickas I looked at the example and the suggestion almost worked I just needed to add a serverURL in the payload.config so that the routes are connected properly

  • discord user avatar
    seanzubrickas
    9 months ago

    nice! so you got it sorted out?

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.