~samhh/bangin-server-node

A basic web server around bangin written in Node.js.
d2488a5c — Sam A. Horvath-Hunt 2 months ago
Update README
ecc94ea5 — Sam A. Horvath-Hunt 2 months ago
0.1.1
b5391dd4 — Sam A. Horvath-Hunt 2 months ago
Don't encodeURI bangin's output

clone

read-only
https://git.sr.ht/~samhh/bangin-server-node
read/write
git@git.sr.ht:~samhh/bangin-server-node

You can also use your local clone with git send-email.

#bangin-server-node

A basic web server around bangin written in Node.js.

#Prerequisites

  • Node.js 10+
  • bangin (in your $PATH)

#Usage

Run the server with:

node index.js [port]

If no port is provided then it will default to 1234.

Requests must include a non-empty value at querystring q. The string will first be routed to bangin before, should that fail, falling back to DuckDuckGo.

The response if successful will be a 303 redirect that browsers can handle.

Examples:

$ curl -I 'http://localhost:1234?q=x!aw'
HTTP/1.1 303 See Other
Location: https://wiki.archlinux.org/index.php?search=x
[...]

$ curl -I 'http://localhost:1234?q=x'
HTTP/1.1 303 See Other
Location: https://duckduckgo.com/?q=x
[...]

#Setting as the browser search engine

#Chrome/similar

  1. Go to chrome://settings/searchEngines.
  2. Add a new search engine with the URL pointing to http://localhost:<port>/?q=%s.

#Firefox

Firefox does not yet support fully custom search engines. You can track the relevant issue here.