# Chain several actions in one route

> List several actions after --> to run them in sequence over the same payload and mark which one answers with (response).

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: en
Content-SHA256: 8510b3a47f4f30e20391383a9d2d13e6c952729718e69a8d657359847aa55490
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

A route can run more than one action: write them one after another after `-->`. They run in order, each receives the same payload, and the first error stops the chain. Add `(response)` after the action whose result must be sent; without it, the last action answers.

```js definitions/order.js
NEWACTION('Order/validate', {
	name: 'Validate the order',
	input: '*product:String, *quantity:Number',
	action: function($, model) {
		model.quantity > 0 ? $.success() : $.invalid('quantity');
	}
});

NEWACTION('Order/save', {
	name: 'Save the order',
	input: '*product:String, *quantity:Number',
	action: function($, model) {
		$.callback({ id: 'order-1', product: model.product, quantity: model.quantity });
	}
});
```

```js controllers/order.js
exports.install = function() {
	ROUTE('POST /order/ --> *Order/validate *Order/save (response)');
};
```
