# app-service

> Method call pipeline composer

Latest version **0.4.0** (published 2015-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install app-service
pnpm add app-service
yarn add app-service
bun add app-service
```

## 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.4.0 |
| Published | 2015-03-27 |
| First published | 2014-11-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Egor Gumenyuk |
| Maintainers | boo1ean |
| Keywords | app-helpers, app-validation, service, decorator, decoration |

## Links

- npm: https://www.npmjs.com/package/app-service
- Repository: https://github.com/boo1ean/app-service
- Issues: https://github.com/boo1ean/app-service/issues
- npm.io page: https://npm.io/package/app-service

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^3.5.0
- [bluebird](https://npm.io/package/bluebird.md) ^2.3.11

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2015-03-27
- 0.3.0 — 2015-03-20
- 0.2.3 — 2014-12-10
- 0.2.2 — 2014-12-02
- 0.2.1 — 2014-12-02
- 0.2.0 — 2014-11-29
- 0.1.0 — 2014-11-24

## README

## app-service

Compose transforming, validation and actual service methods in a strict pipeline

## Installation

```
npm install app-service
```

## Usage

Define transform, validate function and actual method and wire up it through app-service

```js
var build = require('app-service');

function transformCreateUser (params) {
	console.log('transform', params);

	params.email = params.email.toLowerCase();
	return params;
}

function validateCreateUser (params) {
	console.log('validate', params):

	if (params.email.length > 100) {
		throw new Error('Email is toooo long');
	}
}

function createUser (params) {
	console.log(params);
	return 'got it!';
}

var service = build({
	methods: { createUser: createUser },
	validation: { createUser: validateCreateUser },
	transforms: { createUser: transformCreateUser }
});

service.createUser({ email: 'Johny.Dust@example.com' }).then(function (result) {
	console.log(result);
});
```

outputs:

```
transform { email: 'Johny.Dust@example.com' }
validate { email: 'johny.dust@example.com' }
{ email: 'johny.dust@example.com' }
got it!
```

## LICENSE
MIT

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