root-systems / dogstack

:dog: :dog: :dog: a popular-choice grab-bag framework for teams working on production web apps
https://dogstack.js.org/
24 stars 7 forks source link

front and back ends have conflicting urls #78

Open ahdinosaur opened 6 years ago

ahdinosaur commented 6 years ago

example: using the dogstack-example, i browse to /, sign in, then navigate to /dogs. everything is great, until i refresh the page and see an array of dog objects from the dogs service.

why does this happen?

the server api (back end) is not prefixed, so the dogs service is served by feathers-rest at /dogs. this conflicts with the common route for a page that shows all the dogs: /dogs.

this was re-introduced in https://github.com/root-systems/dogstack/commit/912d5a5082057b7a326c927c8251bc1f7b99a3d9, when i added feathers-rest. we've avoided this in Cobuy, purely by chance.

how do we solve this?

we should make a sub-app for all the services, which is prefixed with /api. then use this as the base url for the feathers client. however, we must ensure we handle this bug: https://github.com/feathersjs/feathers/issues/232, which is the reason i avoided using a sub-app when earlier versions of dogstack (on a previous contract) used a sub-app but had annoying edge cases from this.