# sails-hook-route

> Bind route function to res.locals to get the URL of a route by it's name property and replace the named parameters by their values automatically

Latest version **0.0.8** (published 2018-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install sails-hook-route
pnpm add sails-hook-route
yarn add sails-hook-route
bun add sails-hook-route
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2018-05-02 |
| First published | 2018-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Melchyore |
| Maintainers | melchyore |
| Keywords | sails, route, named_parameters, hook, sails-hook |

## Links

- npm: https://www.npmjs.com/package/sails-hook-route
- Repository: https://github.com/Melchyore/sails-hook-route
- Homepage: https://github.com/Melchyore/sails-hook-route#readme
- Issues: https://github.com/Melchyore/sails-hook-route/issues
- npm.io page: https://npm.io/package/sails-hook-route

## Dependencies (1)

- [@sailshq/lodash](https://npm.io/package/@sailshq/lodash.md) ^3.10.2

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.0.8 (latest) — 2018-05-02
- 0.0.7 — 2018-05-02
- 0.0.6 — 2018-05-02
- 0.0.4 — 2018-05-01
- 0.0.3 — 2018-05-01
- 0.0.2 — 2018-05-01
- 0.0.1 — 2018-05-01

## README

# sails-hook-route

[![NPM version](https://badge.fury.io/js/sails-hook-route.svg)](https://badge.fury.io/js/sails-hook-route)

Laravel-like route function for Sailsjs.

# Installation
```sh
$ 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 :

```js
// Some routes
'GET /foo/:id': {
  name: 'foo',
  controller: 'SomeController',
  action: 'bar'
// Some routes
}
```

2) In your template file :

```ejs
<a href="<%= route('foo', 5) %>">Foo</a>
```

and it will produce

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

---
_Source: https://npm.io/package/sails-hook-route · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
