reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
gekkostate 2020-09-04T01:32:32.037100Z

Hi all ! Quick question. I’m using reitit router on the frontend and the backend. How can I forward urls to the frontend router? I have routes which work like `/#/great/person` . However, when I navigate to that route using the browser, I’m redirected to `#/` instead of the route. (I posted on #beginners but someone recommended that I post here as well, hope that’s alright)

gekkostate 2020-09-04T15:09:04.041700Z

In the reitit.frontend.easy/start! , there is a function which requires an on-navigate function. In the on-navigate function we need to include a second history parameter. See https://github.com/metosin/reitit/issues/315

timo 2020-09-04T07:21:43.037500Z

Is it possible to route based on type like string?, int? or a set of strings(enum)?

timo 2020-09-04T09:46:11.039100Z

or maybe someone has a good idea about implementing these endpoints with reitit:

addEndpoint("GET", "/api/stacks/{orgName}/{projectName}/{stackName}/updates", "getStackUpdates")
	addEndpoint("GET", "/api/stacks/{orgName}/{projectName}/{stackName}/updates/latest", "getLatestStackUpdate")
	addEndpoint("GET", "/api/stacks/{orgName}/{projectName}/{stackName}/updates/{version}", "getStackUpdate")
	addEndpoint("GET", "/api/stacks/{orgName}/{projectName}/{stackName}/updates/{version}/contents/files", "getUpdateContentsFiles")
	addEndpoint("GET", "/api/stacks/{orgName}/{projectName}/{stackName}/updates/{version}/contents/file/{path:.*}", "getUpdateContentsFilePath")

	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/destroy", "createDestroy")
	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/preview", "createPreview")
	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/update", "createUpdate")

	addEndpoint("GET", "/api/stacks/{orgName}/{projectName}/{stackName}/{updateKind}/{updateID}", "getUpdateStatus")
	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/{updateKind}/{updateID}", "startUpdate")
	addEndpoint("PATCH", "/api/stacks/{orgName}/{projectName}/{stackName}/{updateKind}/{updateID}/checkpoint", "patchCheckpoint")
	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/{updateKind}/{updateID}/complete", "completeUpdate")
	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/{updateKind}/{updateID}/events", "postEngineEvent")
	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/{updateKind}/{updateID}/events/batch", "postEngineEventBatch")
	addEndpoint("POST", "/api/stacks/{orgName}/{projectName}/{stackName}/{updateKind}/{updateID}/renew_lease", "renewLease")

timo 2020-09-04T09:47:49.040400Z

I mean I could write the routes for updates, destroy, preview and update individually but then I guess I have to do the same for all the endpoints with updateID as well, right?

timo 2020-09-04T09:49:39.041600Z

I could even do the catch all for the updates, destroy, preview and update and sort it out in the handler but I need a good swagger-spec, that's very important

timo 2020-09-04T15:37:57.042200Z

ok, this is obvious now. Solved

timo 2020-09-04T16:22:16.042500Z

mmh, no not solved, damn:(

timo 2020-09-04T16:22:50.043100Z

there seems to be no way to solve this conflict. maybe with programmatically generated routes it would be feasible

timo 2020-09-04T16:23:47.044200Z

but the conflict between /updates/:version and /:update-kind/:update-id persists

timo 2020-09-04T16:41:00.045500Z

ok, so it works actually with inserting :conflicting true, alright