npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angie-rest-framework

v0.0.3

Published

A RESTful API Implementation of the Angie Framework

Downloads

9

Readme

emblem

Angie REST Framework

RESTful API wrapper around Angie Framework Application Endpoints

npm version iojs support node support npm downloads build status code coverage documentation

NPM

About

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.

Usage

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.

Angie

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.