Giter VIP home page Giter VIP logo

Comments (4)

ellisvalentiner avatar ellisvalentiner commented on July 26, 2024

I think I know what you're referring to but could you provide an example?

from plumber.

nihonjinrxs avatar nihonjinrxs commented on July 26, 2024

For example, if I have an API defined in plumber with the following endpoints:

login
dosomething
dosomething/else
logout

normally, they'd be available at something like http://example.com/<endpoint-name>, so:

http://example.com/login
http://example.com/dosomething
http://example.com/dosomething/else
http://example.com/logout

I'd like to be able to set a root path so that they can run at an arbitrary root path on that domain. For example:

http://example.com/api/v1/<endpoint-name>
http://example.com/my-favorite-site/stuff-you-should-look-at/api/the-api-lives-here/<endpoint-name>

I'm thinking a simple parameter setting:

plumber$rootPath = "path/goes/here"

coupled with some simple prefixing in the router is what I'm looking for.

Is that doable?

from plumber.

ellisvalentiner avatar ellisvalentiner commented on July 26, 2024

Ok. That's pretty much the use case I thought you were referring to.

From my own testing (using decorators) you can use a variable path (e.g. /api/<version>/) where the variable is assigned in the global environment but only if it is a single resource.

I don't see a reason why this wouldn't work using the programmatic approach.

On Oct 31, 2016, at 6:48 PM, Ryan B. Harvey [email protected] wrote:

For example, if I have an API defined in plumber with the following endpoints:

login
dosomething
dosomething/else
logout
normally, they'd be available at something like http://example.com/.

I'd like to be able to set a root path so that they can run at an arbitrary root path on that domain. For example:

http://example.com/api/v1/
http://example.com/my-favorite-site/stuff-you-should-look-at/api/the-api-lives-here/
I'm thinking a simple parameter setting:

plumber$rootPath = "path/goes/here"
coupled with some simple prefixing in the router is what I'm looking for.

Is that doable?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

from plumber.

trestletech avatar trestletech commented on July 26, 2024

Good news/bad news.

Good news: you can accomplish this using an external router. I detail how to set this up with nginx using the proxy_pass directive here: http://plumber.trestletech.com/docs/docker-advanced/

Bad news: there isn't a way to do this built-in to plumber yet. But I'm tracking this issue here: #36 The goal of that feature would be to support the notion of defining one plumber router for /login and one for /dosomething and then being able to "install" both of those routers at the /api/v1 location.

That would allow you to modularize the plumber files that constitute a larger application.

I'm going to close this issue as a duplicate of that one, but if you think this issue has a unique component that I'm overlooking feel free to reopen and we can discuss.

from plumber.

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.