# Class: Procedure

## Procedure

#### new Procedure(name, method)

This class handles remote procedure call generation. It is an extension of the NodeApiServer class and is primarily used there. It allows procedures to be created that are exposed to remote clients via the REST interface. Procedures handle their own server code including responding to clients directly.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The name of the procedure.
`method` | function | The handler method.

Source:
  - Procedure.js, line 20

### Methods

- (static) name(nameopt)
- exec(req, res) → {*}
- init(name, method)

#### (static) name(nameopt)

Get / set the procedure name.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`name` | String | <optional> | The name to set.

Source:
  - Procedure.js, line 41

#### exec(req, res) → {*}

Execute the procedure, passing in the request and response (req and res) arguments from the server. Procedure methods are responsible for correctly communicating with the client and handling response properly.

##### Parameters:

Name | Type | Description
--- | --- | ---
`req` |  |
`res` |  |

Source:
  - Procedure.js, line 58

##### Returns:

Type
  *

#### init(name, method)

Create a remote procedure call.

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | The name of the procedure.
`method` | function | The procedure handler.

Source:
  - Procedure.js, line 29