Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iwatakeshi/mobile-redirect
A simple Express middleware to redirect the mobile user.
https://github.com/iwatakeshi/mobile-redirect
Last synced: 6 days ago
JSON representation
A simple Express middleware to redirect the mobile user.
- Host: GitHub
- URL: https://github.com/iwatakeshi/mobile-redirect
- Owner: iwatakeshi
- Created: 2014-11-22T07:45:36.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-03T16:23:10.000Z (about 6 years ago)
- Last Synced: 2024-12-08T13:38:38.980Z (30 days ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
Awesome Lists containing this project
README
mobile-redirect
===============A simple Express middleware to redirect the mobile user.
mobile-redirect will detect if the request is a mobile device. If so, it will redirect the user to your desired path.
[![Build Status](https://travis-ci.org/iwatakeshi/mobile-redirect.svg?branch=master)](https://travis-ci.org/iwatakeshi/mobile-redirect)
[![npm version](https://badge.fury.io/js/mobile-redirect.svg)](http://badge.fury.io/js/mobile-redirect)[![NPM](https://nodei.co/npm/mobile-redirect.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/mobile-redirect/)
##Install
```bash
npm install --save mobile-redirect
```##Usage
```js
var mdirect = require('mobile-redirect');app.use(mdirect());
```###API
`mdirect(opt)`
* *Returns the middleware function that redirects the user to a path.*
* *Accepts an option object to change the default path.*###Options
```js
//default
{
redirectPath: '/mobile'
}
```###Test
```bash
npm test
```*Note: Most tests are covered by [is-mobile](https://github.com/juliangruber/is-mobile). Also, mobile-redirect will cover most mobile devices where is-mobile fails.*