ember-route-objects

Parses ember router definitions into a nested object structure

Usage no npm install needed!

<script type="module">
  import emberRouteObjects from 'https://cdn.skypack.dev/ember-route-objects';
</script>

README

ember-route-objects

The Media Suite

Travis CI Build Status NPM version NPM downloads Dependency Status

Parses ember router definitions into a nested object structure

Install

NPM

  • Install: npm install --save ember-route-objects
  • Module: require('ember-route-objects')

Usage

First require the route objects function that will be used to parse an ember js style router defintion function.

const ro = require('ember-route-objects')

Then pass route objects an ember router definition function.

const routeObjects = ro(function () {
  this.route('users')
  this.route('posts', function () {
    this.route('view', {path: '/:post_id'})
    this.route('list', {path: '/'})
    this.route('create', {method: 'post', path: '/'})
  })
})

And get back a definition object.

[
  {
    name: 'users',
    path: '/users',
    method: 'get',
    resetNamespace: false,
    children: []
  },
  {
    name: 'posts',
    path: '/posts',
    method: 'get',
    resetNamespace: false,
    children: [
      {
        name: 'view',
        path: '/view',
        method: 'get',
        resetNamespace: false,
        children: []
      },
      {
        name: 'list',
        path: '/',
        method: 'get',
        resetNamespace: false,
        children: []
      },
      {
        name: 'create',
        path: '/',
        method: 'post',
        resetNamespace: false,
        children: []
      },
    ]
  }
]

Additional

Note

  • An additional option method is supported which should be specified as an http verb. get|put|patch|post|delete

Further reading

For additional documentation on how to define ember router route definitions please refer to:

History

Discover the release history by heading on over to the releases page.

Backers

Maintainers

These amazing people are maintaining this project:

  • Richard Walker digitalsadhu@gmail.com

Sponsors

These amazing people have contributed finances to this project:

Become a sponsor!

Contributors

These amazing people have contributed code to this project:

License

Unless stated otherwise all works are:

and licensed under: