test/unit/query/search.js
-The fact that it's a singleton was causing problems because at
least one of the tests directly modifies it (this was one of the
reasons why the base query itself was moved into
`createExpectedQuery()`).
-Move it into `createExpectedQuery()` as well.
test/unit/query/search.js
-Rather than writing out full elasticsearch queries as object
literals, use `createExpectedQuery()` as much as possible.
Reduces duplication.
test/unit/query/search.js
-Rather than maintaining a "singleton" expected query object,
which poses problems for tests that want to slightly modify it
(for instance, by conditionally adding a constraint to
`filter.bool.must`), make a function that returns it on demand,
thereby creating a new one each time.
query/category_filter.js
-Define a function that handles injecting category-filtration
logic into elasticsearch queries.
-Abstract it out into a standalone module since it's going to be
used by both `query/search.js` and `query/reverse.js`.
sanitiser/search.js, test/unit/sanitiser/search.js
-Add category filtration to `/search`.
-Fixes (partly) #128
(app, middleware/access_log).js
-Move the logic that determines whether access logging is
necessary to app.js, since that allows us to maintain the style
of `app.use(require(/* desired middleware module */))` inside
`app.js` without returning a "noop" middleware from
`middleware/access_log.js` in the case that it's unnecessary.
(query, query)/*.js
-Remove unused `../src/logger` `require()`s.
src/logger.js, package.json
-Remove `src/logger` in favor of using `pelias-logger` for all
logging, since it's the Pelias standard.
middleware/500.js
-Replace usage of `src/logger` with pelias-logger.
README.md
-Edit a bunch of unrelated things... sorry. ;)
-Condense the documentation of different `npm run`nable commands
to one list.
-Remove the note about Travis, since that applies to virtually
all the Pelias repos and is documented elsewhere.
-Point the API docs hyperlink to `DOCS.md`.
middleware/500.js
-cf1a483 changed the middleware to return an opaque error
message rather than the error object itself, in case it contains
sensitive information. The problem is that some sanitizers
return a helpful error message (intended to be seen by users) as
a string. Add a conditional to only return the ambiguous,
catchall error message when a non-string `err` object is
received -- this will likely be a stack trace, or something.