Routes: anything/this

If my intention si to code a route that accepts a POST at whateverurl/streams, should I use this pattern?

	[
		'pattern' => 'streams',
		'method' => 'post',
		'action'  => function () {

		}
	],

I assume that to be a relative streams after any url, such as localhost/kirbysiterootfolder/whatever/more/streams

And that using…

	[
		'pattern' => '/streams',
		'method' => 'post',
		'action'  => function () {

		}
	],

…would make it absolute to base url, so always localhost/kirbysiterootfolder/streams

Is that correct ?

Thank you

To attach streams to any url you can use the (:all) placeholder:

'pattern' => '(:all)/streams',

Thank you,

But, how does Kirby interpret a slash-less route if not as relative to root url ?

Thanks

A slash-less route only refers to http(s)://yourdomain.com/streams, not to http(s)://yourdomain.com/whatever/comes/here/streams.

1 Like