Skip to content

Commit

Permalink
Add NestJS Example
Browse files Browse the repository at this point in the history
  • Loading branch information
ahilke committed Mar 5, 2021
1 parent 6c22977 commit ef8bba0
Show file tree
Hide file tree
Showing 13 changed files with 7,843 additions and 0 deletions.
53 changes: 53 additions & 0 deletions examples/9-nestjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# NestJS Example

This example demonstrates how to use `express-openapi-validator` with [NestJS](https://nestjs.com/).

## Install

From this `9-nestjs` directory, run:

```shell
npm ci
```

## Run

### Start Server

#### Watch Mode

```shell
npm run start
```

or

```shell
npm run start:dev
```

#### Production Mode

```shell
npm run build
npm run start:prod
```

### Requests

```shell
curl --request GET --url http://localhost:3000/ping/foo
```

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

## Tests

```shell
npm run test
```
12 changes: 12 additions & 0 deletions examples/9-nestjs/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
moduleFileExtensions: ['ts', 'js'],
testMatch: ['**/*.spec.ts'],
transform: {
'\\.ts': 'ts-jest',
},

testEnvironment: 'node',
};
export default config;
7 changes: 7 additions & 0 deletions examples/9-nestjs/nest-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": false,
"tsConfigPath": "tsconfig.json"
}
}
Loading

0 comments on commit ef8bba0

Please sign in to comment.