All Projects → rvboris → Koa Useragent

rvboris / Koa Useragent

Licence: mit
Koa user-agent middleware

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Koa Useragent

Service Tools
Prepare your Node.js application for production
Stars: ✭ 89 (+64.81%)
Mutual labels:  middleware, koa
polix
🚀 Node.js Web Framework
Stars: ✭ 32 (-40.74%)
Mutual labels:  middleware, koa
Awilix Koa
Awilix helpers/middleware for Koa 2
Stars: ✭ 121 (+124.07%)
Mutual labels:  middleware, koa
Koatty
Koa2 + Typescript = Koatty. Use Typescript's decorator implement IOC and AOP.
Stars: ✭ 67 (+24.07%)
Mutual labels:  middleware, koa
Grant
OAuth Proxy
Stars: ✭ 3,509 (+6398.15%)
Mutual labels:  middleware, koa
Tsed
📐 Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone.
Stars: ✭ 1,941 (+3494.44%)
Mutual labels:  middleware, koa
Koa Hbs
Handlebars templates for Koa.js
Stars: ✭ 156 (+188.89%)
Mutual labels:  middleware, koa
doa
A middleware framework for Deno's http serve🦕. Transplanted from Koa with ❤️
Stars: ✭ 20 (-62.96%)
Mutual labels:  middleware, koa
stats
📊 Request statistics middleware that stores response times, status code counts, etc
Stars: ✭ 15 (-72.22%)
Mutual labels:  middleware, koa
koa-waterline
Deprecated: A middleware for your hose
Stars: ✭ 14 (-74.07%)
Mutual labels:  middleware, koa
Koa Helmet
Important security headers for koa
Stars: ✭ 595 (+1001.85%)
Mutual labels:  middleware, koa
Concurrency Logger
Log HTTP requests/responses separately, visualize their concurrency and report logs/errors in context of a request.
Stars: ✭ 400 (+640.74%)
Mutual labels:  middleware, koa
Kona
a node.js service framework built on koa.js (generators)
Stars: ✭ 23 (-57.41%)
Mutual labels:  middleware, koa
Guzzle Stopwatch Middleware
A Guzzle Stopwatch Middleware
Stars: ✭ 50 (-7.41%)
Mutual labels:  middleware
L Passport
Koa middleware and api sdk for wechat oauth, qq oauth, baidu oauth and weibo oauth
Stars: ✭ 52 (-3.7%)
Mutual labels:  koa
Authorization
PSR7 Middleware for authorization
Stars: ✭ 50 (-7.41%)
Mutual labels:  middleware
Egg Authz
egg-authz is an authorization middleware for Egg.js based on Casbin
Stars: ✭ 50 (-7.41%)
Mutual labels:  middleware
Graphql Upload
Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
Stars: ✭ 1,071 (+1883.33%)
Mutual labels:  koa
Django Channels React Multiplayer
turn based strategy game using django channels, redux, and react hooks
Stars: ✭ 52 (-3.7%)
Mutual labels:  middleware
Fclub
Vue全家桶+Koa+mongoose全栈开发的单页应用 http://wap.fulun.club
Stars: ✭ 49 (-9.26%)
Mutual labels:  koa

koa-useragent

Greenkeeper badge CircleCI branch npm

Fast Middleware exposing user-agent for koa.js based on express-useragent


Installation

$ npm install koa-useragent

Usage overview

const koa = require('koa');
const app = koa.app();
const { userAgent } = require('koa-useragent');

app.use(userAgent);

app.use(async (ctx, next) {
  console.log(require('util').inspect(ctx.userAgent));
});

app.listen(3000);

Typescript example

import Koa, { BaseContext } from 'koa';
import { userAgent, UserAgentContext } from 'koa-useragent';

const app = new Koa();

app.use(userAgent);

app.use<BaseContext, UserAgentContext>((ctx) => {
  console.log(require('util').inspect(ctx.userAgent));
});

app.listen(3000);

Module provides details such as the following:

{
  "isMobile":false,
  "isDesktop":true,
  "isBot":false,
  .....
  "browser":"Chrome",
  "version":"17.0.963.79",
  "os":"Windows 7",
  "platform":"Microsoft Windows",
  "source":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.79 Safari/535.11"
}

Typescript support

From version 2.1.0 the library has rewritten in typescript. Definitions files distribute with source files.

From version 1.2.0, the library has type typescript definition file. You can install them from npm.

npm install --save-dev @types/koa-useragent

Author

Boris Ryabov ([email protected]).

Based on express-useragent by Aleksej Gordejev ([email protected]).

License

(The MIT License)

Copyright (c) 2019 Boris Ryabov [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].