Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/choojs/choo-redirect
🎬 - Redirect a view to another view
https://github.com/choojs/choo-redirect
Last synced: 1 day ago
JSON representation
🎬 - Redirect a view to another view
- Host: GitHub
- URL: https://github.com/choojs/choo-redirect
- Owner: choojs
- License: mit
- Created: 2016-12-13T12:38:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-20T01:42:13.000Z (over 7 years ago)
- Last Synced: 2024-05-22T01:16:09.551Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 19
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-choo - choo-redirect - Redirect a view to another view. (Uncategorized / Uncategorized)
README
# choo-redirect [![stability][0]][1]
[![npm version][2]][3] [![build status][4]][5] [![test coverage][6]][7]
[![downloads][8]][9] [![js-standard-style][10]][11]Redirect a view to another view.
## Usage
```js
var redirect = require('choo-redirect')
var html = require('choo/html')
var choo = require('choo')var app = choo()
app.route('/', redirect('/welcome'))
app.route('/welcome', welcomeView)app.mount('body')
function welcomeView () {
return html`
welcome!
`
}
```## API
### view = redirect(route, rootSelector?)
Create a new view that redirects to a `route`. Can take an optional second
argument for the root selector which is used as the entry point of the
application. Defaults to `document.body`.## Installation
```sh
$ npm install choo-redirect
```## License
[MIT](https://tldrlegal.com/license/mit-license)[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/choo-redirect.svg?style=flat-square
[3]: https://npmjs.org/package/choo-redirect
[4]: https://img.shields.io/travis/yoshuawuyts/choo-redirect/master.svg?style=flat-square
[5]: https://travis-ci.org/yoshuawuyts/choo-redirect
[6]: https://img.shields.io/codecov/c/github/yoshuawuyts/choo-redirect/master.svg?style=flat-square
[7]: https://codecov.io/github/yoshuawuyts/choo-redirect
[8]: http://img.shields.io/npm/dm/choo-redirect.svg?style=flat-square
[9]: https://npmjs.org/package/choo-redirect
[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[11]: https://github.com/feross/standard