Mukun
Mukun

Reputation: 157

How to add a prefix based routes in Luracast/Restler

I'm using Luracast/Restler php framework. I know it have the privilege to use version based URLs in it using the Defaults::$useUrlBasedVersioning property and $restler->setAPIVersion() function. I have a requirement like instead of using the version based URL [Ex: v1/resource] I want to add prefix like api [Ex: api/resource]. I don't want to make this prefix change via server configuration. I want to add this changes in the gateway file. As like I added v1 prefix in the first example.

Upvotes: 0

Views: 46

Answers (1)

azerttyu
azerttyu

Reputation: 11

Looks like it's a related to this issue that I've opened at https://github.com/Luracast/Restler/issues/691.

The workaround that I use, is actually a hard-coded solution. In the Restler.php file, change the request parameters like this:

$_SERVER['SCRIPT_NAME'] = "/api/";

Upvotes: 0

Related Questions