#How to redirect directly localhost:3000/admin port when server start

17 messages ยท Page 1 of 1 (latest)

stray ice
#

How to redirect directly localhost:3000/admin port when server start

gaunt oriole
#

Hi @stray ice ๐Ÿ‘‹

I'm confused what you mean here, can you provide some clarification on your use case and what issue you're experiencing specifically?

lament tartan
#

if you want to redirect it to some other port just do PORT=8080 pnpm dev, for local, but similar thing for prod

#

Keep in mind that if you tweak something, you could loose images, etc because of wrongly set PORT.

stray ice
#

No,I mean how to redirect home directory (/) to /admin in payload admin panel .once start the server .I just want only the admin panel.how to do that?

gaunt oriole
#

Keep in mind you also have to move the (payload)/admin to the (payload) root folder

#

As specified in that warning there

stray ice
#

in my home directory, where my frontend is accessible at /, and the Payload Admin panel is at /admin. However, I want to disable the frontend and automatically redirect to /admin when the server starts. How can I achieve this using middleware or configuration within Payload CMS?

gaunt oriole
#

But this is not a Payload concept, this is something more to do with Next

stray ice
#

Thanks for the help! I'm new to both Next.js and payload.js and still learning how things work.Before this, I used Filament,and I'm trying to compare how payload and filament handle things.So far I see that Payload is more flexible with Next.js

#

In Filament, there's a built-in feature for seeding data.But i couldn't find a similar feature in payload.Should I write a custom script,or is there a recommended approach?

gaunt oriole
#

I would do that either in a custom endpoint like the website template does, or use the onInit function that runs once the server starts, with Payload there's many ways to seed data honestly

#

Glad you figured the redirects out though

toxic lotusBOT