Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for base url #8

Open
SwatDoge opened this issue Jul 11, 2022 · 2 comments
Open

Allow for base url #8

SwatDoge opened this issue Jul 11, 2022 · 2 comments

Comments

@SwatDoge
Copy link

I'd love to ability to set a base url. If you have a url like:

example.com/api/*

It would be great if you could set the base url to be /api/

@mattreid1
Copy link
Owner

The current behaviour is the path is taken from the hostname and path, e.g. http://0.0.0.0:3000/api. You can handle routes like the following:

app.get("/api/get", (ctx) => {
  return ctx.sendText("Hello");
});

Is this roughly what you mean or do you want to just do this?

app.get("/get", (ctx) => {
  return ctx.sendText("Hello");
});

@SwatDoge
Copy link
Author

I'd like the last thing, where by default "/get" would get prefixed by "/api/" if you choose so. This would mean you could just write "/boots" "/get" instead of "api/boots" and "api/get".

Simular concept to the html base tag: https://www.w3schools.com/TAGs/tag_base.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants