Make the home page's AS name search work (closes #151)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The AS Name Search card on the home page said the search was coming soon. It now asks the new GET /api/v1/search/as?q=<text>, which searches the AS list built into asinfo, and lists the matches as links to their AS pages. The answer holds the query, the number of matches and the first 50 of them; an empty q answers 400. asinfo.Search now ignores case, uses strings.Contains instead of its own substring loop, and returns its matches in AS number order. A number, or AS and a number, typed into the card still opens that AS's page. The card builds the list with textContent, since the names come from outside data. Model: opus-5-5
This commit is contained in:
@@ -56,8 +56,8 @@ Every route answers `HEAD` as it answers `GET`, without the body.
|
||||
|
||||
### Web Interface
|
||||
|
||||
- `GET /` - Home page (HTML): headline figures, and lookups by AS number and by
|
||||
IP address
|
||||
- `GET /` - Home page (HTML): headline figures, lookups by AS number and by IP
|
||||
address, and a search of AS names
|
||||
- `GET /status` - HTML status dashboard, which reads `/api/v1/stats`
|
||||
- `GET /status.json` - JSON statistics: feed, memory, database and route figures
|
||||
- `GET /.well-known/healthcheck.json` - Health check (JSON): 200 when the
|
||||
@@ -96,6 +96,18 @@ Every route answers `HEAD` as it answers `GET`, without the body.
|
||||
apart, each with when its newest route was updated
|
||||
- `GET /api/v1/prefix/{prefix}/{length}` - Every live route for the prefix, one
|
||||
per peer, and the same routes grouped by origin AS in `origins`
|
||||
- `GET /api/v1/search/as?q={text}` - Finds the ASes whose handle or description
|
||||
contains `{text}`, ignoring case. `data` holds:
|
||||
- `query`: `{text}` without its leading and trailing spaces
|
||||
- `total`: the number of ASes that match
|
||||
- `results`: the first 50 of them in AS number order, each with `asn`,
|
||||
`handle` and `description`
|
||||
|
||||
The search reads the AS list built into RouteWatch, taken from
|
||||
[ipverse/asn-info](https://github.com/ipverse/asn-info), not the database. A
|
||||
match can therefore be an AS that the database does not hold. Its
|
||||
`/as/{asn}` and `/api/v1/as/{asn}` then answer 404. A `q` that is missing,
|
||||
empty or only spaces answers 400.
|
||||
|
||||
A JSON answer is `{"status": "ok", "data": ...}`, or for an error
|
||||
`{"status": "error", "error": {"msg": ..., "code": ...}}`, and carries an
|
||||
|
||||
Reference in New Issue
Block a user