Closed ryangjchandler closed 3 years ago
~Actually, ignore me. Test isn't actually testing anything because the config isn't being set in the right place.~ Testing the controller is going to be a bit more difficult, since we can override the config inside of a test but at that point the routes have already been registered.
I like all the changes, especially the new script! I'll take a look later today at the changes and give it a bit of a test.
If you can't get the test working, it's no problem... I might just throw one together to check that a route is registered with the expected path (or something like that)
@ash-jc-allen I got the test working - just needed to create a separate file so that I could overwrite the prefix for the entire test file. All passing :)
@ryangjchandler Sweet, I appreciate you sorting it.
The only issue I can see with this approach is that if anyone already has any short URLs stored in their DB, if they switch their short-url.prefix
, the existing routes will stop working. Personally, I can't see this being a huge problem because I don't think anyone would change the prefix on an already existing app. But, I'll make sure to mention something in the docs just in case :)
Adds support for changing the prefix of a short URL via the
short-url.prefix
configuration option. Defaults to/short
to ensure backwards-compatibility with existing applications.