0.0.8 • Published 6 years ago
sails-hook-route v0.0.8
sails-hook-route
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
}
2) In your template file :
<a href="<%= route('foo', 5) %>">Foo</a>
and it will produce
<a href="/foo/5">Foo</a>