<commit_before># Development Mode
**Don't use this in production!**

## About

```javascript
config.general = {
  developmentMode: true
}
```

actionhero's development mode is a little different than tools like [nodemon](https://github.com/remy/nodemon) in that it tries hard not to restart the server process. Changes to routes, tasks, and actions can simply replace those in memory when they are updated on disk. Other changes, like changes to `api.config` or initializers are more severe, and will restart the whole application (much like nodemon).

To enable development mode simply set `developmentMode: true` in your `config/api.js`.

## Effects of Development Mode

Development mode, when enabled, will poll for changes in your actions, tasks and initializers, and reload them on the fly.

- this uses `fs.watchFile()` and may not work on all OSs / file systems.
- new files won't be loaded in, only existing files when the app was booted will be monitored
- as deleting a file might crash your application, we will not attempt to re-load deleted files
- if you have changed the `task.frequency` of a periodic task, you will continue to use the old value until the task fires at least once after the change
- changing `api.config`, initializers, or servers, will attempt to do a "full" reboot the server rather than just reload that component.

## Watching custom files

```javascript
api.watchFileAndAct(path_to_file, function(){
  api.log('rebooting due to config change: ' + path_to_file, 'info');
  api.commands.restart.call(api._self);
});
```

You can use actionhero's `watchFileAndAct()` method to watch additional files your application may have:<commit_msg>add a note about developmentMode vs NODE_ENV<commit_after># Development Mode
**Don't use this in production!**

## About

```javascript
config.general = {
  developmentMode: true
}
```

actionhero's development mode is a little different than tools like [nodemon](https://github.com/remy/nodemon) in that it tries hard not to restart the server process. Changes to routes, tasks, and actions can simply replace those in memory when they are updated on disk. Other changes, like changes to `api.config` or initializers are more severe, and will restart the whole application (much like nodemon).

To enable development mode simply set `developmentMode: true` in your `config/api.js`.

Note that `api.config.general.developmentMode` is different from `NODE_ENV`, which by default is "development" (and is logged out when actionhero boots).  `NODE_ENV` is used to determine which config settings to use, and has no effect on developmentMode.

## Effects of Development Mode

Development mode, when enabled, will poll for changes in your actions, tasks and initializers, and reload them on the fly.

- this uses `fs.watchFile()` and may not work on all OSs / file systems.
- new files won't be loaded in, only existing files when the app was booted will be monitored
- as deleting a file might crash your application, we will not attempt to re-load deleted files
- if you have changed the `task.frequency` of a periodic task, you will continue to use the old value until the task fires at least once after the change
- changing `api.config`, initializers, or servers, will attempt to do a "full" reboot the server rather than just reload that component.

## Watching custom files

```javascript
api.watchFileAndAct(path_to_file, function(){
  api.log('rebooting due to config change: ' + path_to_file, 'info');
  api.commands.restart.call(api._self);
});
```

You can use actionhero's `watchFileAndAct()` method to watch additional files your application may have:
{'fraction_non_alphanumeric': 0.07679603633360858, 'fraction_numerical': 0.0, 'mean_word_length': 4.722834645669291, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3743256', 'n_tokens_mistral': 968, 'n_tokens_neox': 921, 'n_words': 498}