{"id":20251858,"url":"https://github.com/osdevisnot/mojolicious-plugin-rest","last_synced_at":"2025-12-12T02:43:19.257Z","repository":{"id":18543679,"uuid":"21744747","full_name":"osdevisnot/Mojolicious-Plugin-REST","owner":"osdevisnot","description":null,"archived":false,"fork":false,"pushed_at":"2015-09-02T16:48:01.000Z","size":312,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T23:16:30.007Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"generalassembly-atx/lotr-dom-manipulation-lab","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osdevisnot.png","metadata":{"files":{"readme":"README.mkdn","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-11T17:14:37.000Z","updated_at":"2024-02-25T21:37:08.000Z","dependencies_parsed_at":"2022-09-13T04:54:35.047Z","dependency_job_id":null,"html_url":"https://github.com/osdevisnot/Mojolicious-Plugin-REST","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2FMojolicious-Plugin-REST","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2FMojolicious-Plugin-REST/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2FMojolicious-Plugin-REST/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osdevisnot%2FMojolicious-Plugin-REST/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osdevisnot","download_url":"https://codeload.github.com/osdevisnot/Mojolicious-Plugin-REST/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312133,"owners_count":21082638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T10:13:23.186Z","updated_at":"2025-12-12T02:43:19.225Z","avatar_url":"https://github.com/osdevisnot.png","language":"Perl","readme":"# NAME\n\nMojolicious::Plugin::REST - Mojolicious Plugin for RESTful operations\n\n# VERSION\n\nversion 0.006\n\n# SYNOPSIS\n\n    # In Mojolicious Application\n    $self-\u003eplugin( 'REST' =\u003e { prefix =\u003e 'api', version =\u003e 'v1' } );\n\n    $routes-\u003erest_routes( name =\u003e 'Account' );\n\n    # Installs following routes:\n\n    # /api/v1/accounts             ....  GET     \"Account::list_account()\"    ^/api/v1/accounts(?:\\.([^/]+)$)?\n    # /api/v1/accounts             ....  POST    \"Account::create_account()\"  ^/api/v1/accounts(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId  ....  DELETE  \"Account::delete_account()\"  ^/api/v1/accounts/([^\\/\\.]+)(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId  ....  GET     \"Account::read_account()\"    ^/api/v1/accounts/([^\\/\\.]+)(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId  ....  PUT     \"Account::update_account()\"  ^/api/v1/accounts/([^\\/\\.]+)(?:\\.([^/]+)$)?\n\n\n    $routes-\u003erest_routes( name =\u003e 'Feature', under =\u003e 'Account' );\n\n    # Installs following routes:\n\n    # /api/v1/accounts/:accountId/features             B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features\n    #   +/                                             ....  GET     \"Feature::list_account_feature()\"    ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/features             B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features\n    #   +/                                             ....  POST    \"Feature::create_account_feature()\"  ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/features/:featureId  B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features/([^\\/\\.]+)\n    #   +/                                             ....  DELETE  \"Feature::delete_account_feature()\"  ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/features/:featureId  B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features/([^\\/\\.]+)\n    #   +/                                             ....  GET     \"Feature::read_account_feature()\"    ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/features/:featureId  B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features/([^\\/\\.]+)\n    #   +/                                             ....  PUT     \"Feature::update_account_feature()\"  ^(?:\\.([^/]+)$)?\n\n\n    $routes-\u003erest_routes( name =\u003e 'Product', under =\u003e 'Account', types =\u003e [qw(ftp ssh)] );\n\n    # Installs following routes:\n\n    # /api/v1/accounts/:accountId/products      B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products\n    #   +/                                      ....  GET     \"Product::list_account_product()\"         ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/products      B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products\n    #   +/                                      ....  POST    \"Product::create_account_product()\"       ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/products/ftp  B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products/ftp\n    #   +/                                      ....  DELETE  \"Product::Ftp::delete_account_product()\"  ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/products/ssh  B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products/ssh\n    #   +/                                      ....  DELETE  \"Product::Ssh::delete_account_product()\"  ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/products/ftp  B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products/ftp\n    #   +/                                      ....  GET     \"Product::Ftp::read_account_product()\"    ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/products/ssh  B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products/ssh\n    #   +/                                      ....  GET     \"Product::Ssh::read_account_product()\"    ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/products/ftp  B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products/ftp\n    #   +/                                      ....  PUT     \"Product::Ftp::update_account_product()\"  ^(?:\\.([^/]+)$)?\n    # /api/v1/accounts/:accountId/products/ssh  B...  *       \"Account::chained()\"                      ^/api/v1/accounts/([^\\/\\.]+)/products/ssh\n    #   +/                                      ....  PUT     \"Product::Ssh::update_account_product()\"  ^(?:\\.([^/]+)$)?\n\n# DESCRIPTION\n\n[Mojolicious::Plugin::REST](https://metacpan.org/pod/Mojolicious::Plugin::REST) adds various helpers for [REST](http://en.wikipedia.org/wiki/Representational_state_transfer)ful\n[CRUD](http://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations via\n[HTTP](http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) to your mojolicious application.\n\nAs much as possible, it tries to follow [RESTful API Design](https://blog.apigee.com/detail/restful_api_design) principles from Apigee.\n\nUsed in conjuction with [Mojolicious::Controller::REST](https://metacpan.org/pod/Mojolicious::Controller::REST), this module makes building RESTful application a breeze.\n\nThis module is inspired from [Mojolicious::Plugin::RESTRoutes](https://metacpan.org/pod/Mojolicious::Plugin::RESTRoutes).\n\n# WARNING\n\nThis module is still under development, and it's possible that things may change between releases without warning or deprecations.\n\n# MOJOLICIOUS HELPERS\n\n## rest\\_routes\n\nA routes shortcut to easily add RESTful routes for a resource and associations.\n\n# MOJOLICIOUS HOOKS\n\nThis module installs an before\\_render application hook, which gurantees JSON output.\n\nRefer [Mojolicious::Controller::REST](https://metacpan.org/pod/Mojolicious::Controller::REST) documentation for output format.\n\nHook installation can be disabled by passing hook =\u003e 0 in plugin options. For Example:\n\n    $self-\u003eplugin( 'REST', prefix =\u003e 'api', version =\u003e 'v1', hook =\u003e 0 );\n\n# OPTIONS\n\nFollowing options can be used to control route creation:\n\n- methods\n\n    This option can be used to control which methods are created for declared rest\\_route. Each character in the value of this option,\n    determines if corresponding route will be created or ommited. For Example:\n\n        $routes-\u003erest_routes( name =\u003e 'Account', methods =\u003e 'crudl' );\n\n    This will install all the rest routes, value `crudl` signifies:\n\n        c - create\n        r - read\n        u - update\n        d - delete\n        l - list\n\n    Only methods whose first character is mentioned in the value for this option will be created. For Example:\n\n        $routes-\u003erest_routes( name =\u003e 'Account', methods =\u003e 'crd' );\n\n    This will install only create, read and delete routes as below:\n\n        # /api/v1/accounts             ....  POST    \"Account::create_account()\"  ^/api/v1/accounts(?:\\.([^/]+)$)?\n        # /api/v1/accounts/:accountId  ....  DELETE  \"Account::delete_account()\"  ^/api/v1/accounts/([^\\/\\.]+)(?:\\.([^/]+)$)?\n        # /api/v1/accounts/:accountId  ....  GET     \"Account::read_account()\"    ^/api/v1/accounts/([^\\/\\.]+)(?:\\.([^/]+)$)?\n\n    Option value `crd` signifies:\n\n        c - create,\n        r - read,\n        d - delete\n\n    Old **readonly** behaviour can thus be achieved using:\n\n        $routes-\u003erest_routes( name =\u003e 'Account', methods =\u003e 'cl' );\n\n    This will install only create and list routes as below:\n\n        # /api/v1/accounts  ....  GET   \"Account::list_account()\"    ^/api/v1/accounts(?:\\.([^/]+)$)?\n        # /api/v1/accounts  ....  POST  \"Account::create_account()\"  ^/api/v1/accounts(?:\\.([^/]+)$)?\n\n- name\n\n    The name of the resource, e.g. 'User'. This name will be used to build the route url as well as the controller name.\n\n- controller\n\n    By default, resource name will be converted to CamelCase controller name. You can change it by providing controller name.\n\n    If customized, this options needs a full namespace of the controller class.\n\n- under\n\n    This option can be used for associations. If present, url's for named resource will be created under given under resource. The actions created,\n    will be bridged under `method_chained` method of given under resouce. For Example:\n\n        $routes-\u003erest_routes( name =\u003e 'Feature', under =\u003e 'Account' );\n\n    This will create following routes, where routes for feature are bridged under `Account::chained()`\n\n        # /api/v1/accounts/:accountId/features             B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features\n        #   +/                                             ....  GET     \"Feature::list_account_feature()\"    ^(?:\\.([^/]+)$)?\n        # /api/v1/accounts/:accountId/features             B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features\n        #   +/                                             ....  POST    \"Feature::create_account_feature()\"  ^(?:\\.([^/]+)$)?\n        # /api/v1/accounts/:accountId/features/:featureId  B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features/([^\\/\\.]+)\n        #   +/                                             ....  DELETE  \"Feature::delete_account_feature()\"  ^(?:\\.([^/]+)$)?\n        # /api/v1/accounts/:accountId/features/:featureId  B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features/([^\\/\\.]+)\n        #   +/                                             ....  GET     \"Feature::read_account_feature()\"    ^(?:\\.([^/]+)$)?\n        # /api/v1/accounts/:accountId/features/:featureId  B...  *       \"Account::chained()\"                 ^/api/v1/accounts/([^\\/\\.]+)/features/([^\\/\\.]+)\n        #   +/                                             ....  PUT     \"Feature::update_account_feature()\"  ^(?:\\.([^/]+)$)?\n\n    Note that, The actual bridge code needs to return a true value or the dispatch chain will be broken. Please refer\n    [Mojolicious Bridges Documentation](https://metacpan.org/pod/Mojolicious::Guides::Routing#Bridges) for more information on bridges in Mojolicious.\n\n- types\n\n    This option can be used to specify types of resources available in application.\n\n# PLUGIN OPTIONS\n\n- method\\_chained\n\n    If present, this value will be used as a method name for chained methods in route bridges.\n\n- prefix\n\n    If present, this value will be added as prefix to all routes created.\n\n- version\n\n    If present, this value will be added as prefix to all routes created but after prefix.\n\n- htt2crud\n\n    If present, given HTTP to CRUD mapping will be used to determine method names. Default mapping:\n\n        {\n            collection =\u003e {\n                get  =\u003e 'list',\n                post =\u003e 'create',\n            },\n\n            resource =\u003e {\n                get    =\u003e 'read',\n                put    =\u003e 'update',\n                delete =\u003e 'delete'\n            }\n        }\n\n# AUTHOR\n\nAbhishek Shende \u003cabhishekisnot@gmail.com\u003e\n\n# CONTRIBUTOR\n\nVincent HETRU \u003cvincent.hetru@13pass.com\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2014 by Abhishek Shende.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosdevisnot%2Fmojolicious-plugin-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosdevisnot%2Fmojolicious-plugin-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosdevisnot%2Fmojolicious-plugin-rest/lists"}