Coder Social home page Coder Social logo

Comments (7)

joshhills avatar joshhills commented on June 22, 2024 1

Thanks for the quick reply! I think the info log message could be considered a bug given it ultimately points to a URL that doesn't work - perhaps an extra line in the docs section for hosting at a sub-path?

I gave that a whirl and it worked. Do you know if there are other paths that need adjusting to ensure that no resources get hosted at the root? I can see options for API etc. in the routes block, but I also see a paths object used as part of the file upload mechanism (?) further down in the configuration? Ideally I need to find a way to scope every Payload resource (CSS/JS, routes...) to foo so that it doesn't fight with the other apps

from payload.

jmikrut avatar jmikrut commented on June 22, 2024 1

Totally. IMO we really just need to enforce that the serverURL itself does not contain a path - only protocol, domain, port. That would then solve the info log. Well, that and some improved docs of course. Thoughts?

The only routes that get mounted by Payload are the ones that you can customize through the routes config property. Everything that Payload does Express-wise will be scoped accordingly so nothing outside of those routes will compete with your apps whatsoever. Including all statically served CSS, JS, etc. required by the admin panel.

The paths property is actually no longer used and is left over in the config type. We will remove that - good eye!

from payload.

jmikrut avatar jmikrut commented on June 22, 2024 1

Good point regarding pedantics. We will keep an eye out for further requests and should be able to facilitate basePath support in one way or another if it’s important to the community.

I say we keep this issue open until we can do the following:

  • remove paths from config type
  • update docs to be more explicit about the above
  • enforce that serverURL does not contain a path

We can take a stab at that stuff tomorrow!

from payload.

jmikrut avatar jmikrut commented on June 22, 2024 1

Closed with #28 .

from payload.

joshhills avatar joshhills commented on June 22, 2024

Upon further investigation it appears that the issue may lie with the API URL, as the page at e.g. /foo/admin attempts to hit http://localhost:3000/api/users/me as opposed to http://localhost:3000/foo/api/users/me

from payload.

jmikrut avatar jmikrut commented on June 22, 2024

Hey @joshhills!

This is actually not intended functionality, and there may be a way to do exactly what you’re looking to do with current functionality.

Can you try setting your routes.admin to /cms/admin and just leave your serverURL equal to http://localhost:3000?

If this works for your needs, we will make sure to update the docs accordingly!

from payload.

joshhills avatar joshhills commented on June 22, 2024

Yes, I think to be pedantic, "URL" can typically contain a path, so either a comment or splitting it into those individual fields (though that might be more boilerplate) should suffice. Support for a basePath to automatically pre-pend the routes fields might be a good feature request if others also run into the same issue? Additionally, showing the default URLs in one place might be useful - I had to skip between docs pages to grab them all - unless I'm missing something.

RE other routes - good to know! From reading the docs on uploads, I gather that I can ensure that media uploads are scoped accordingly by making the staticURL and staticDir also contain /foo in some way. I think it's very elegant that it's suggested that media be its own collection type (though you might want to include that in the npx setup alongside TODOs, I imagine it'll be necessary for most projects?).

I'll try setting them all, creating a collection with file uploads, and close with a final comment when it works?

from payload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.