Global Constant
Steve Nay's ramblings

Creating a RESTful web service with KRL

Phil Windley’s example of creating a blog using KRL got me thinking about what other (somewhat unconventional) things could be done with KRL. The first that came to my mind is building a RESTful web service.

The advantages of setting up a web service this way include zero configuration (just write a ruleset and deploy it), awesome integration with data sources all over the web, an extensible rule-based language, and drop-dead simple persistent data storage.

I put together a simple example. It has four methods:

I’m using webhooks to implement this. The URLs aren’t super pretty, and they probably wouldn’t be desirable as endpoints for a production system. But it’s easy enough to build a proxy in front of them.

You can try out this web service with the following URLS:

Here’s the source code:

Many thanks to Sam for his answer yesterday on StackOverflow.

Older article
CS 462: In conclusion