Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/garu/dancer-plugin-restmodel
REST model class for Dancer apps
https://github.com/garu/dancer-plugin-restmodel
Last synced: 11 days ago
JSON representation
REST model class for Dancer apps
- Host: GitHub
- URL: https://github.com/garu/dancer-plugin-restmodel
- Owner: garu
- Created: 2014-10-10T17:49:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-10T17:56:58.000Z (about 10 years ago)
- Last Synced: 2024-11-05T21:50:34.679Z (about 2 months ago)
- Language: Perl
- Size: 121 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
Dancer-Plugin-RESTModel
========================This plugin lets you talk to a REST server as a separate model from within
your Dancer (http://perldancer.org) app. It is useful for keeping your API
decoupled from your app while still being able to manage it through the
configuration file.BASIC USAGE
-----------set the REST endpoint in your Dancer configuration file:
```yaml
plugins:
RESTModel:
MyData:
server: http://localhost:5000
type: application/json
clientattrs:
timeout: 5
```then use it from any of your routes/controllers:
```perl
use Dancer ':syntax';
use Dancer::Plugin::RESTModel;get '/' => sub {
my $res = model('MyData')->post( 'foo/bar/baz', { meep => 'moop' } );my $code = $res->code; # e.g. 200
my $data = $res->data;...
};
```INSTALLATION
------------# from CPAN
$ cpan Dancer::Plugin::RESTModel# from cpanm
$ cpanm Dancer::Plugin::RESTModel# cloning the repository
$ git clone git://github.com/EstanteVirtual/Dancer-Plugin-RESTModel.git# manual installation, after downloading
perl Makefile.PL
make
make test
make installCOPYRIGHT AND LICENCE
---------------------Copyright (C) 2013, Breno G. de Oliveira
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.