3 ms·
>> What happens if the URL changes? > Cool urls don't change. Use configs. I also kinda think that for many webapps, the risk of this is somewhat overstated.
by hospadar 5y ago
>> What happens if the URL changes?
> Cool urls don't change. Use configs.
I also kinda think that for many webapps, the risk of this is somewhat overstated. I've got tons of apps with a few hard-coded URL paths that point at other internal apps that I own. They don't break because I don't randomly remove URL paths from services. When I do need to change something, find-and-replace + an integration test keep me safe 99.99% of the time (and the blast radius from a failure like this is usually very small - obvious 404 error bubbles up immediately the first time someone hits something broken).
That said, I agree that keeping constants like URL paths in configs is a fine idea. I also feel that common sense is required - a tiny webservice which makes a single request to one URL path probably is fine to just hard-code it (and in fact putting all constants into config might be overly obfuscating), but a big app which makes dozens or hundreds of calls obviously benefits from a config-oriented approach
- 9dev 5y ago> a tiny webservice which makes a single request to one URL path that's how they all start out, don't they?