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

default discord avatar
BrandonMager
2 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
    notchr
    2 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
    Payload Team
    last month

    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
    BrandonMager
    last month

    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
    Payload Team
    last month

    nice! so you got it sorted out?

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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