{"id":22433636,"url":"https://github.com/gavinning/express-detector","last_synced_at":"2025-03-27T07:45:44.486Z","repository":{"id":57231807,"uuid":"66632171","full_name":"gavinning/express-detector","owner":"gavinning","description":"Express格式化ua中间件，检查Client是PC或者Mobile","archived":false,"fork":false,"pushed_at":"2016-08-26T09:07:26.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T12:46:31.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gavinning.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-26T08:47:25.000Z","updated_at":"2016-10-27T13:20:28.000Z","dependencies_parsed_at":"2022-09-13T21:10:47.483Z","dependency_job_id":null,"html_url":"https://github.com/gavinning/express-detector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fexpress-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fexpress-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fexpress-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinning%2Fexpress-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinning","download_url":"https://codeload.github.com/gavinning/express-detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245806390,"owners_count":20675296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T22:15:30.653Z","updated_at":"2025-03-27T07:45:44.466Z","avatar_url":"https://github.com/gavinning.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"express-detector\n---\n\n### Install\n```sh\nnpm i express-detector --save\n```\n\n### Usage\n```js\nvar detector = require('express-detector');\n\napp.use(detector());\n```\n```js\nrouter.all('*', (req, res) =\u003e {\n    console.log(req.env)\n    // 是否跳转到移动端\n    req.env.isMobile ? res.redirect('http://m.domain.com') : next();\n})\n```\nconsole.log( req.env ) =\u003e\n```js\n{\n    device: {\n        name: 'iphone',\n        version: -1,\n        fullVersion: '-1',\n        iphone: -1\n    },\n    os: {\n        name: 'ios',\n        version: 9.1,\n        fullVersion: '9.1',\n        ios: 9.1\n    },\n    engine: {\n        name: 'webkit',\n        version: 601.1,\n        fullVersion: '601.1.46',\n        mode: 601.1,\n        fullMode: '601.1.46',\n        compatible: false,\n        webkit: 601.1\n    },\n    browser: {\n        name: 'safari',\n        version: 9,\n        fullVersion: '9.0',\n        mode: 9,\n        fullMode: '9.0',\n        compatible: false,\n        safari: 9\n    },\n    isPC: false,\n    isMobile: true\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Fexpress-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinning%2Fexpress-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinning%2Fexpress-detector/lists"}