A couple of hours ago I needed a break from the project I'm currently working on, so decided to flex my Node.js muscles again. This time I've developed a really simple but useful server that presents a simple API for resolving short URLs to their final destination.
Here's the README file...
FURL is a service written in Node.js to provide an HTTP API for resolving short URLs.
It's highly recommended that this is run behind a mature web server such as nginx - this is advice from the creator of Node so pay attention Bond!
- All configurable variables are at the top of the source file.
- Call / and it will return the destination URL. If an error occurs it will return a message starting with ERR.
- Call it with /stats to get a JSON response containing various stats.
- Call it with /clean to trigger a cache cleaning operation. This will return the number of objects deleted during the clean.
- Move the configuration out to a conf file.
- Add the ability to have an hourly per-IP limit to prevent abuse.
- Add the option of using a memcached instance for the cache so it can be shared across multiple instances of the daemon behind a load balancer.
- I've not really stress-tested it yet, but the tests I have done show it to be pretty stable.