# stop-server [![](https://badge.fury.io/js/stop-server.svg)](https://www.npmjs.com/package/stop-server) [![](https://travis-ci.org/typicode/stop-server.svg?branch=master)](https://travis-ci.org/typicode/stop-server)

> Shut down your computer with your phone :iphone: (works on OS X, Linux and Windows), and execute .bat file from your path

## Install

```sh
npm install -g our-stop-server
```

```sh
our-stop-server start # Need to be done only once
```

## Usage

Visit [`http://your-local-ip:5708`](http://localhost:5708/qr.html) __on your phone__. You should see this page:

![](http://i.imgur.com/4WadpZc.png)

__Important__ if you're on OS X or Linux, you need to allow commands to be used without sudo:

```bash
# Run 'sudo visudo' and add
your-username ALL=NOPASSWD: /sbin/shutdown       # OS X and Linux
your-username ALL=NOPASSWD: /usr/sbin/pm-suspend # Linux only
```

__Tip__ for easier access, you can get a QR code by going to [http://localhost:5708/qr.html](http://localhost:5709/qr.html) from your computer

## Uninstall

```
npm rm -g our-stop-server
```

## How it works?

`our-stop-server` is a simple Express server with only 2 routes:

```
POST http://your-local-ip:5708/power-off
POST http://your-local-ip:5708/sleep
GET  http://your-local-ip:5708/open?path=your-path
```

## License

MIT 
