A lightweight HTTP server that parses User-Agent strings and returns structured JSON responses.
Install dependencies and start the server:
npm install
npm startBy default, the server listens on port 3000. You can set PORT to change it.
Health-check endpoint:
curl http://localhost:3000/
# → {"status":"ok"}Parse User-Agent strings:
curl http://localhost:3000/parse \
-H "User-Agent: YourUserAgentString"Note: If no CACHE_CONTROL environment variable is provided, the server responds with a default Cache-Control: public, max-age=0 header.
You’ll receive a JSON payload with ua, browser, engine, os, device, cpu, plus Cache-Control and ETag headers for client caching.
Start the server with a custom header:
CACHE_CONTROL="private, max-age=3600" npm startThen request the parse endpoint:
curl -I http://localhost:3000/parse \
-H "User-Agent: TestAgent/1.0"
# → Cache-Control: private, max-age=3600See the full release notes in CHANGELOG.md.
Run the full test suite:
npm testGenerate a coverage report:
npm run coveragecurl -i \
-H "If-None-Match: <etag>" \
http://localhost:3000/your-endpointIf the resource has not changed, the server responds with:
HTTP/1.1 304 Not Modified
Cache-Control: public, max-age=0
ETag: