Skip to content

Files

9-nestjs

NestJS Example

This example demonstrates how to use express-openapi-validator with NestJS.

Install

From this 9-nestjs directory, run:

npm ci

Run

Start Server

Watch Mode

npm run start

or

npm run start:dev

Production Mode

npm run build
npm run start:prod

Requests

curl --request GET --url http://localhost:3000/ping/foo
curl --request POST \
  --url http://localhost:3000/ping \
  --header 'Content-Type: application/json' \
  --data '{"ping": "GNU Terry Pratchett"}'

validation error

curl --request POST \
  --url http://localhost:3000/ping \
  --header 'Content-Type: application/json' \
  --data '{"pingoo": "GNU Terry Pratchett"}'|jq

Tests

npm run test