npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kill-9

v0.4.3

Published

A way for kill node server from client navigator

Downloads

17

Readme

kill-9

a way to kill node process from client navigator. Something like http://yoursite.kom/kill-9

extending npm-version downloads linux windows coverage dependencies

language: English also available in: Spanish

Install

$ npm install kill-9

Use it in the client navigator

use kill-9 as a url in the navigator

API

var express = require('express');
var app = express();

var kill9 = require('kill-9');

var server = app.listen(3000, function() {
    console.log('Listening on port %d', server.address().port);
});

app.use(kill9({log:true}));

// complete example:
function site_up(req,res){
    var kill_url='kill-9?pid='+process.pid;
    res.send("<h1>kill-9 demo</h1><p>site up<p>try <a href="+kill_url+">"+kill_url+"</a>");
}

app.get('/index.html',site_up);
app.get('/',site_up);

kill9([options])

Returns a function middleware to use with express.use. Once installed you can kill the process typing "kill sentence" in the navigator.

Example:

http://thesite.kom/kill-9?pid=12345

option | type | default value | details --------------|---------|---------------|------------------------- statement | text | "kill-9" | The statement that you must type in the url. pid | integer | process.pid | The pid value that you must pass in the pid parameter. By default kill-9 uses the real pid obteined from pid property of process object: process.pid log | boolean | false | If log is set kill-9 show a console.log when it is installed. You can send true or a message. statusKilled | integer | 200 | The status sent in the response for the case of success. location | url | | The location for a redirect. This is mandatory if statusKilled between 300 and 303. messageKilled | text | "kill -9 success" | The message to display in successful kills. statusBad | integer | 404 | The status sent when the pid doesn't match. locationBad | url | | The location for a redirect. This is mandatory if statusKilled between 300 and 303. messageBad | text | "kill -9 unknown" | The message to display when when the pid doesn't match. process | object | process | The process option is for test purpose. You can pass a mock object.

app.use(kill9({log:"remember to delete in production"}));

// Supose that exists getMode(). This is better
if(getMode()=='develop'){
    app.use(kill9({log:true}));
}
app.use(kill9({statusKilled:301, location:'other_site.kom'}));
app.use(kill9({messageKilled: "I'll be back"}));
app.use(kill9({messageBad: "Not foud"}));
function ProcessMock(){
    this.pid=444;
    this.codeRecived=null;
    this.exit=function(code){
        this.codeRecived=code;
    }
}

var pm=new ProcessMock();
test_app.use(
    kill9({process:pm})
).get(
    'kill-9?pid=444'
).then(function(){
    assert.equal(mp.codeRecived, 444);
});

Notes

  • This is not secure in production servers. Use it only in developer servers. Kill-9 lacks of password or validate user or any way for confirm legal use.
  • Actually options.pid can be a text, but I don't know if this will change in the future.

License

GPL-2.0