actions

1.3.0 • Public • Published

Actions

Actions for a resourceful controller, CURD.
Rails-like actions.

Source code

// http://guides.rubyonrails.org/routing.html
 
// Resource
exports.ACTIONS = [
  'index',    // GET        `posts#index`   `/posts`
  'create',   // POST       `posts#create`  `/posts`
  'new',      // GET        `posts#new`     `/posts/new`
  'show',     // GET        `posts#show`    `/posts/:id`
  'update',   // PATCH/PUT  `posts#update`  `/posts/:id`
  'destroy',  // DELETE     `posts#destroy` `/posts/:id`
  'edit'      // GET        `posts#edit`    `/posts/:id/edit`
];
 
// SingletonResource
exports.SINGLETON_ACTIONS = [
  'show',     // GET        `post#show`    `/post/:id`
  'create',   // POST       `post#create`  `/post`
  'update',   // PATCH/PUT  `post#update`  `/post/:id`
  'destroy',  // DELETE     `post#destroy` `/post/:id`
  'new',      // GET        `post#new`     `/post/new`
  'edit'      // GET        `post#edit`    `/post/:id/edit`
];
 
// Canonical Actions
exports.CANONICAL_ACTIONS = [
  'index',    // GET        `posts#index`   `/posts`
  'create',   // POST       `posts#create`  `/posts`
  'new',      // GET        `posts#new`     `/posts/new`
  'show',     // GET        `posts#show`    `/posts/:id`
  'update',   // PATCH/PUT  `posts#update`  `/posts/:id`
  'destroy',  // DELETE     `posts#destroy` `/posts/:id`
];

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i actions

Weekly Downloads

8,333

Version

1.3.0

License

MIT

Last publish

Collaborators

  • fundon