cloudflare / worker-template-router

231 stars 84 forks source link

Added base url feature + Trailing slash bug fix #21

Closed nikhiljohn10 closed 3 years ago

nikhiljohn10 commented 4 years ago

This was developed as a result of a bug found related to trailing "/" in the url. This will fix the bug and ignore the case in which use forget to add "/" in the end of url. It also enable the root of api not just to be "/", but anything that is passed along new Router(base_url) parameter.

As per the updated index.js, const r = new Router("/api/v1") www.example.com/api/v1 => Hello worker www.example.com/api/v1/ => Hello worker www.example.com/api/v1/find/bar => responding for /bar www.example.com/api/v1/find/bar/ => responding for /bar www.example.com => resource not found www.example.com/ => resource not found

TODO: Update README & DEMO with /api/v1 url extension.

nikhiljohn10 commented 4 years ago

@EverlastingBugstopper I was wondering if someone could take a look in to this PR.

EverlastingBugstopper commented 4 years ago

Hey @nikhiljohn10 - I'm not super familiar with this project and am a bit tied up with some other projects right now. Maybe @signalnerve or @victoriabernard92 have some extra bandwidth to take a look at this.

I think this project which is not maintained by Cloudflare is a bit more battle-tested though I'm not sure if it's actively maintained either.

simplenotezy commented 3 years ago

@EverlastingBugstopper Would you by chance know anyone who could take some eyes on this? https://github.com/cloudflare/worker-template-router/issues/33 it's the only thing that prevents us currently from deploying to Workers

EverlastingBugstopper commented 3 years ago

Hey @simplenotezy - Unfortunately, I haven't worked at Cloudflare since about halfway through 2020 and I'm not sure who is currently maintaining the Workers templates. I do know there's a Workers discord that you could maybe get some answers from.

nikhiljohn10 commented 3 years ago

Closing this PR as this repo is dormant.