From f2199370a64e72bea6c1f9cf86a64ab6fdf9e2ea Mon Sep 17 00:00:00 2001 From: "Eirik S. Morland" Date: Tue, 17 Oct 2017 21:01:04 +0200 Subject: [PATCH] docs(readme): Update the README to clarify a bit. --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1564ca0..e031351 100644 --- a/README.md +++ b/README.md @@ -12,22 +12,22 @@ This module comes with 2 utilities: One is the server that you can start, to cra In its easiest usage, all you need to do is the following: -### Install as dependency. -``` +### Install as dependency +```bash $ npm i -S kill-switch ``` ### Create a config file -``` +```bash $ echo '{"port": 3000,"secret": "secret"}' > .kill-switch.json ``` ### Add kill-switch autostart to your app. -``` +```js // Somewhere in your index.js or main app: const ks = require('kill-switch') ks.autoStart() ``` ### Add an npm script to kill your app, and probably one for your continuous deployment -``` +```json "scripts": { "start": "node index.js", "deploy": "STUPID_EXAMPLE_BUT git pull && npm i && npm run kill", @@ -35,6 +35,10 @@ ks.autoStart() }, ``` +## How does it work + +In its easiest usage the autostart server will use the config in your kill-switch config to start a server where it is ready to crash your app. Then when you deploy, the command line tool will look for the same config, and therefore know the server where it is supposed to request a path to kill your app. This way, after the deploy, your app will be reloaded, given you use some sort of process manager to restart your app automatically. + ## API ```js