Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/no0dles/abox-validator
https://github.com/no0dles/abox-validator
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/no0dles/abox-validator
- Owner: no0dles
- License: mit
- Created: 2016-10-02T20:09:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-03T09:23:45.000Z (over 8 years ago)
- Last Synced: 2024-04-28T04:42:06.427Z (9 months ago)
- Language: TypeScript
- Size: 17.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# abox-validator - Api Toolkit Validations
[![Build Status](https://travis-ci.org/no0dles/abox-validator.svg?branch=master)](https://travis-ci.org/no0dles/abox-validator)
[![npm version](https://badge.fury.io/js/abox-validator.svg)](https://badge.fury.io/js/abox-validator)
[![codecov.io](http://codecov.io/github/no0dles/abox-validator/coverage.svg?branch=master)](http://codecov.io/github/no0dles/abox-validator?branch=master)## Quickstart
### Installation
```
npm install abox-validator --save
```### Code Example
action.ts
```typescript
import {Action} from "abox";
import {Pattern, Required} from "abox-validator";@Action({ name: "ping" })
export class Ping {
@Required()
@Pattern(/^[a-z]$/)
public message: string
}
```app.ts
```typescript
import {Api} from "abox";
import * as validator from "abox-validator";
import {Ping} from "./actions";const api = new Api();
api.use(validator.module);
api
.on(Ping)
.handle((context, data) => {
//...
});export = api;
```