I finally finished my URL shortener microservice but I thought on something during the start of the process:
Isn’t sending a GET request that changes the state of the DB or server bad for the RESTful API guidelines?
So, I decided to create a simple frontend for the API and create a full-fledged URL shortener APP but still keep it veery simple and bare-bones; no fancy hashes with salt (it has 8 chars long, alphanumeric) and double-checks, no GET request endpoint to reveal a shortened URL (though I could implement it in a near future) nor did I create the functionality to view all URLs saved, that’d be against privacy I think (but I do know how to do it).
Is there a CORS API that I can use to test it without the fronted? Sure, I set cors: true, for the entire server so, you can go ahead and use Postman, jQuery, Axios or CURL.
http://shortio.herokuapp.com/new and the only param is “url”.
In return you’ll get an object or an error, the success object has a key called “hash” that you can append to the base URL, I may change “hash” for “shortened” soon.