Home Identifier Source Repository


Angie REST Framework

RESTful API wrapper around Angie Framework Application Endpoints

build status iojs support node support code coverage npm downloads



This package allows you to wrap your Angie application routes in endpoints specific to their RESTful methods. It includes many serializers to parse incoming data and renderers to parse outgoing data.


This package does not ship with Angie by default. It is an extension of the included Angie application functionality.

npm i angie-rest-framework

In your Angie application AngieFile.json, be sure to include the package as a dependency.

Then, when you specify your Angie routes in a config:

app.config(function($APIRoutes) {
    $APIRoutes.when('/test', {
        controller: 'TestController',
        serializers: [ 'JSONSerializer', 'XMLSerializer' ],
        renderer: 'JSONRenderer',
        template: 'test'

The template included in the route above will not be rendered, Angie REST Framework does not support specifying routes in this fashion.

Next, we must define a controller. This is done in a similar fashion to Angie, but the app.Controller method is called with a class instead:

class TestController {
    constructor($scope) {
        // ...do something with the $scope
    get($request, $response) {
        // ...do something with $response.content;
    post($request, TestModel) {
        // ...do something with posted data: $request.data

app.Controller('TestController', TestController);

Injecting dependencies works very much the same way it does with regular controllers. You may also use the decorator provided with the injector to accomplish dependency injection in this fashion.

Based on the method of your request, your controller will now route the response through the declared methods on the instantiated controller and declare errors if data serialization fails, data rendering fails, or there is no declared method for the specified method. Errors will also be thrown if serializer or renderer classes cannot be found.

It is worth noting that "HEAD" and "OPTIONS" requests do not need to be declared. These requests return headers based on the request as specified they should by the HTTP spec.

For a list of Frequently Asked Questions, please see the FAQ and the CHANGELOG for an up to date list of changes. Contributors to this Project are outlined in the CONTRIBUTORS file.


Please see the site for information about the project, a quickstart guide, and documentation and the CHANGELOG for an up to date list of changes.