Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Samrith Shankar committed Feb 17, 2020
1 parent e52b65e commit 2fe9112
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ for the icon.
## Table of contents

- [Why Nodehawk?](#why-nodehawk)
- [Installation and usage](#installation-and-usage)
- [Installation](#installation)
- [Usage](#usage)
- [Configurations](#configurations)
- [Basic](#basic)
- [Performance](#performance)
Expand All @@ -46,35 +47,33 @@ make development of Node servers less cumbersome. It primarily focuses on
providing a watcher that addresses
[issues around watching and restarting](https://stackoverflow.com/questions/4075287/node-express-eaddrinuse-address-already-in-use-kill-server).

## Installation and usage
## Installation

There are two ways to use this. Either install it globally or add it as a
development dependency.

Installing globally using NPML
- Installing globally:

```bash
# with npm
npm i -g nodehawk
```

or with Yarn:

```bash
# with yarn
yarn global add global nodehawk
```

Adding the package as a dev dependency to your project with NPM:
- Adding the package as a dev dependency to your project:

```bash
# with npm
npm i -D nodehawk
```

or with Yarn:

```bash
# with yarn
yarn add -D nodehawk
```

## Usage

For using the watcher, simple add a script to your `package.json`:

```json
Expand All @@ -89,13 +88,22 @@ For using the watcher, simple add a script to your `package.json`:
> process. Use it to run your app on that port. All you need to do is:
```diff
- server.listen(<your-existing-port>);
+ server.listen(process.env.PORT);
- app.listen(<your-existing-port>);
+ app.listen(process.env.PORT);
```

> This will help Nodehawk kill the process running on the port to prevent any
> `EADDRINUSE` errors. You can customize the port in the configurations below.
**You need to provide an exec command in a `.nodehawkrc` file. The simplest one
for your server can be:**

```json
{
"exec": "node src/server"
}
```

The watcher will run with the default configurations, and automatically start
watching your `src` directory. If you want to customize it further, you can read
the whole list of configurations, which can be specified in a `.nodehawkrc` file
Expand All @@ -118,10 +126,11 @@ of these configurations are provided through a `.nodehawkrc` file.

### Performance

| Key | Type | Default | Description |
| ------- | -------------- | ------- | ------------------------------------------------------------------------------------------------- |
| buffer | number | `300` | Buffer delay in milliseconds to wait for events after which the `exec` command should be trigger. |
| ignored | string\|regexp | `""` | A path or glob of files or folders to be ignored. |
| Key | Type | Default | Description |
| ---------- | -------------- | ------- | --------------------------------------------------------------------------- |
| buffer | number | `1500` | Buffer to wait for events after which the `exec` command should be trigger. |
| bufferPoll | number | `100` | Poll to check the stability of the buffer. |
| ignored | string\|regexp | `""` | A path or glob of files or folders to be ignored. |

### Display

Expand Down

0 comments on commit 2fe9112

Please sign in to comment.