1.1.0 • Published 9 years ago

ember-route-objects v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Parses ember router definitions into a nested object structure

NPM

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:

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

These amazing people are maintaining this project:

These amazing people have contributed finances to this project:

Become a sponsor!

These amazing people have contributed code to this project:

Unless stated otherwise all works are:

and licensed under: