npm.io
0.0.8 • Published 8 years ago

sails-hook-route

Licence
MIT
Version
0.0.8
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
1

sails-hook-route

NPM version

Laravel-like route function for Sailsjs.

Installation

$ npm install sails-hook-route

How to use

  1. In your config/routes.js file, add a name property for a route you want to be named :
// Some routes
'GET /foo/:id': {
  name: 'foo',
  controller: 'SomeController',
  action: 'bar'
// Some routes
}
  1. In your template file :
<a href="<%= route('foo', 5) %>">Foo</a>

and it will produce

<a href="/foo/5">Foo</a>

Keywords