castis/seaforium — pull request #88 by notjosh (2013-02-28 02:20:34+00:00)
Title: API stuff, etc, etc!

well hello!

here we have a good base for JSON API responses. CI sucks a bit, so the actual mechanism is pretty clunky, and also we're outputting in controllers, so I had to create code paths for that too. :bullettrain_side: But for the most, what I've done shouldn't impact existing code (or performance/caching if we're using anything there. Are we?)

but. for now there are API endpoints set up for:
- user login/reg
- posting
- messages
- (reading) user profiles

To use: add `?format=json` to any URL and it'll try to serve JSON templates for the same controller/view (the view file will be `path/to/view.json.php`), or there's a base-controller (lols `MY_Controller`) which lets you query if it's a JSON request.

I'll add more as I need it, but that's enough for me for now.

There's tests for almost everything I've done (afaik). Which is also clunky. But it seems to work fine*.

(*you'll hit post limits, so we should create a config.php option to disable limits per-instance)

:RR:
:two_hearts: