- dev-toolbox/files
Files module.
- dev-toolbox
The dev-toolbox module.
- dev-toolbox/server
Server module.
- dev-toolbox/server/TempServer
The TempServer module.
- path(path) ⇒
string Returns a normalized path.
- root([path]) ⇒
string Returns a normalized path relative to the project's root directory.
- getHost([host]) ⇒
string Returns the host.
- getPort([port]) ⇒
number Returns a free port.
- getUrl([host], [port]) ⇒
string Returns the URL. The default URL is "http://127.0.0.1:8080".
- startTempServer([...args]) ⇒
Promise.<TempServer> Starts a temporary server for testing purposes.
Files module.
The dev-toolbox module.
Server module.
The TempServer module.
Kind: global class
- TempServer
- new TempServer(host, port)
- .host ⇒
string - .port ⇒
number - .start() ⇒
Promise.<TempServer> - .stop() ⇒
Promise.<TempServer>
Creates a temporary server for test purposes.
| Param | Type | Description |
|---|---|---|
| host | string | The port of the temporary server. |
| port | number | The port of the temporary server. |
Returns the host.
Kind: instance property of TempServer
Returns: string - The host.
Returns the port.
Kind: instance property of TempServer
Returns: number - The port.
tempServer.start() ⇒ Promise.<TempServer>
Starts the temporary server.
Kind: instance method of TempServer
tempServer.stop() ⇒ Promise.<TempServer>
Stops the temporary server.
Kind: instance method of TempServer
Returns a normalized path.
Kind: global function
Returns: string - The normalized path.
| Param | Type | Description |
|---|---|---|
| path | string | The path to be normalized. |
Returns a normalized path relative to the project's root directory.
Kind: global function
Returns: string - The normalized path relative to the project's root directory.
| Param | Type | Description |
|---|---|---|
| [path] | string | The path to use to normalize. If none given, only the project's root directory will be used. |
Returns the host.
Kind: global function
Returns: string - The host.
| Param | Type | Description |
|---|---|---|
| [host] | string | The host. The default host is "127.0.0.1". |
Returns a free port.
Kind: global function
Returns: number - The free port.
| Param | Type | Description |
|---|---|---|
| [port] | number | The port. If no port given, the default port is 8080. |
Returns the URL. The default URL is "http://127.0.0.1:8080".
Kind: global function
Returns: string - The URL with the given port.
| Param | Type | Description |
|---|---|---|
| [host] | string | The host. The default host is "127.0.0.1". |
| [port] | number | The port. If no port given, the default port is 8080. |
startTempServer([...args]) ⇒ Promise.<TempServer>
Starts a temporary server for testing purposes.
Kind: global function
| Param | Type | Description |
|---|---|---|
| [...args] | * | If one argument is specified, that will be the (port). If two arguments, they will be the (host, port). |