Config 1.5: REST Verbs

When visitor passes action=string in the request, Genelet will follow up the specific action in the component, ignoring http’s Request Method. This allows you to build unlimited actions on components.

When there is no action specified,  the RESTful actions (also called verbs) will be determined from the Request Method.

Default_actions   default: {"GET":"topics", "GET_item":"edit", "PUT":"update", "POST":"insert", "DELETE":"delete"}

The keys in the object are http’s Request Methods, and the values the REST verbs. The GET_item is to denote a special type of GET request having item id attacked in the URL:

In case you’d like to change the above default settings, you can re-define Default_actions.

The 5 verbs correspond to the following CRUD operations, which are always inherited in every component.

  • topics: to list all items in the table, usually a SELECT in SQL
  • edit: to list details of one specific item, usually a SELECT with restriction WHERE id=
  • update: to update an item, usually UPDATE in SQL
  • insert: to add new item, usually INSERT in SQL
  • delete: to delete an item, usually DELETE in SQL

For your convenience, there is an empty, do-nothing verb startnew being available. For example, when you launch a blank page to input new record, you may call this action.