How do I have two different routes with the same URL in two different packages in my meteor app?

209 views Asked by At

I'm trying to write an app that uses the ActivityPub standard. Specifically, right now, I'm trying to implement the "retrieving objects" part, where a GET request to an objects id with the content header including application/ld+json; profile="https://www.w3.org/ns/activitystreams" or application/activity+json will fetch the activitypub representation of that object. However, as it suggests in the article, and as many other activitypub implementations do, I also want to present an HTML page at that URL when the content header asks for HTML.

Furthermore, I want to specify these routes in separate packages - one in the backend and one in the frontend, so as to allow different frontends to be written for the same backend. Is this possible? My current investigations would suggest it's not, but I'm not sure yet. Perhaps I need to define the route in the backend, and have it check content header and select response there, but allow the frontend to configure the backend to point to a particular template?

I'm currently using Restivus in the backend and Iron:Router in the frontend, but I'm willing to change both of these if necessary.

1

There are 1 answers

0
Angle On

Well, I'm not sure this is the best way to do it, but eventually I just made the route in the backend and had it check for accept: text/html and if found, redirect it to another route. I'd like to be able to hide the redirect from the client, but this is close enough for now.