~samhh/bangin-server-node

ref: 417affe8b837b9d12de2505b37ea8c17aa455726 bangin-server-node/README.md -rw-r--r-- 1.1 KiB
417affe8 — Sam A. Horvath-Hunt Initial 6 months ago

#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.