Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Commit

Permalink
updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
stearm committed Oct 28, 2017
1 parent bbf41d7 commit 34fb52a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
[![Build Status](https://travis-ci.org/stearm/micro-joi.svg?branch=master)](https://travis-ci.org/stearm/micro-joi) [![npm](https://img.shields.io/npm/v/micro-joi.svg)](https://www.npmjs.com/package/micro-joi)
# micro-joi
A [Joi](https://github.com/hapijs/joi) wrapper for [Micro](https://github.com/zeit/micro)
A [Joi](https://github.com/hapijs/joi) wrapper for [Micro](https://github.com/zeit/micro) to validate your request body and query parameters.

It's possible to validate both body and query parameters, or only one of these.
To validate both, use `body` and `query` key in the schema:
```javascript
Joi.object({
body: Joi.object({
...
}),
query: Joi.object({
...
})
});
```
but you can validate only body or query. To keep api backward compatible, you can omit `body` and `query`: write the shape of your request body directly, look at the examples below.

## Examples

Expand Down

0 comments on commit 34fb52a

Please sign in to comment.