stop-server
stop-server copied to clipboard
Change post to get by default
This application is awesome, now I am thinking about using it with an ESP8266 to check whether I am in the bed and automatically put my computer after two minutes to sleep if I don't override the function by opening a webpage or don't get off the bed in that time. (check capacitive body sensing on hackaday) Worked out of the box on Windows 10, while Windows 10's automatic sleep refuses to work most of the time.
In the original application I'd just change the app.post to app.get because when I first got this I used it with my phone as a http://ip:port/sleep shortcut and I needed to change the post to get.
I am actually amazed how well this is written for such a simple task and nodejs makes it a breeze to hack. I got a giggle when I saw that just changing .post to .get did the trick.
I used it with my phone as a http://ip:port/sleep shortcut and I needed to change the post to get.
I created derhuerst/shutdown-server
for this reason.
It uses HTML forms to send a POST
request, because POST
is both semantically correct and a lot safer from accidental triggering.
Anyway, :+1: for the great idea @typicode!