1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26# Example application using [`joi`](https://github.com/sideway/joi) and [`next-joi`](https://github.com/codecoolture/next-joi)
This example shows how to validate Next.js API routes by using the `joi` and `next-joi` packages. It contains samples for both API routes using a [Connect middleware](https://github.com/hoangvvo/next-connect) (see `/api/people`) and regular API routes (see `/api/cars`).
## Deploy your own
[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-joi&project-name=with-joi&repository-name=with-joi)
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
```bash
npx create-next-app --example with-joi with-joi-app
```
```bash
yarn create next-app --example with-joi with-joi-app
```
```bash
pnpm create next-app --example with-joi with-joi-app
```
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).