X-Git-Url: https://git.cworth.org/git?p=nodemuch;a=blobdiff_plain;f=example.js;fp=example.js;h=0000000000000000000000000000000000000000;hp=fb57c915549157c8b4f0d78cc027853600db1526;hb=a7666a88da31cb770f62af6a0de7b7422feb3874;hpb=0f2625afe523247a0229511db1dbffba9dd560dc diff --git a/example.js b/example.js deleted file mode 100644 index fb57c91..0000000 --- a/example.js +++ /dev/null @@ -1,24 +0,0 @@ -var http = require( "http" ), - parse = require( "url" ).parse, - exec = require( "child_process" ).exec; - -http.createServer( function(req, res) { - var url = parse( req.url ), - action = url.pathname.split( "/" ).splice(-1)[0]; - if ( action === "search" ) { - exec( "notmuch search " + url.query, function( error, stdout, stderr ) { - res.writeHead( 200, { "Content-Type": "text/plain" } ); - res.end( stdout ); - }); - } else if ( action === "show" ) { - exec( "notmuch show " + url.query, function( error, stdout, stderr ) { - res.writeHead( 200, { "Content-Type": "text/plain" } ); - res.end( stdout ); - }); - } else { - res.writeHead( 404 ); - res.end("404"); - } -}).listen( 8124, "127.0.0.1" ); - -console.log( "Server running at http://127.0.0.1:8124/" );