This project is a simple Express.js server that parses user agent strings. It uses the ua-parser-js library to parse the user agent string and return the result.
index.ts: This is the main server file. It sets up an Express.js server and defines a route that parses user agent strings.
Install dependencies with bun i.
Start the server with bun run index.ts.
Build the image with docker build -t uaservice ..
The server has one route:
GET /: This route accepts a user agent string as a query parameter (ua) or reads it from theUser-Agentheader if no query parameter is provided. It returns a parsed user agent object.
PORT: The port the server listens on. Defaults to 3000 if not provided.
-
express: A minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. -
ua-parser-js: A useragent string parser library. It can parse almost any user agent string and extract detailed information from it.