Skip to content

Commit 623a944

Browse files
minor formatting
1 parent 417dd02 commit 623a944

File tree

5 files changed

+89
-1
lines changed

5 files changed

+89
-1
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Notes on programming languages, network, systems, calendars, etc.
33
### Programming Languages and Development Tools
44

55
* [**Programming Language Notes**](./programming) - notes on Java, JavaScript, node.js, etc.
6+
* [SQL](./sql)
67
* [**git**](./git) - notes on git revision control
78

89
### Linux

Diff for: programming/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
* [Java](./java)
44
* [Kotlin](./kotlin)
5-
* [SQL](./sql)
65
* [JavaScript, TypeScript and Node.js](./javascript)
76
* [R Statistical Language](./rscript), which I used in my Master Thesis for generating a large number of graphs programmatically
87
* [Go notes](./go)

Diff for: programming/javascript/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
* [Node.js](./nodejs.md) information on **Node Version Manager** `nvm`
1515
* [npm](./npm.md) information on **Node Package Manager** `npm`
16+
* [NestJS](./nestjs.md) information on the **NestJS** framework
1617

1718
#### Resources
1819

Diff for: programming/javascript/nestjs.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
### NestJS
2+
3+
Running the nestjs binary without installing it globally
4+
5+
```bash
6+
npx -p @nestjs/cli nest
7+
```
8+
9+
#### Setup
10+
11+
```bash
12+
npx -p @nestjs/cli nest new <app name>
13+
```
14+
15+
##### Running the [CLI](https://docs.nestjs.com/cli/overview)
16+
17+
```bash
18+
npx nest <command> <arguments>
19+
```
20+
21+
22+
#### Swagger documentation
23+
24+
https://docs.nestjs.com/openapi/introduction
25+
26+
```bash
27+
npm install @nestjs/swagger swagger-ui-express
28+
```
29+
30+
Setup CLI plugin
31+
https://docs.nestjs.com/openapi/cli-plugin
32+
33+
#### Validation
34+
35+
https://docs.nestjs.com/techniques/validation
36+
37+
```bash
38+
npm install class-validator class-transformer
39+
npm install reflect-metadata --save
40+
```
41+
42+
Add `app.useGlobalPipes(new ValidationPipe({transform: true}));`
43+
44+
uses class-validator https://github.com/typestack/class-validator
45+
46+
#### Logging
47+
48+
https://stackoverflow.com/questions/54101926/nestjs-middleware-get-request-response-body
49+
50+
#### [Documentation](https://docs.nestjs.com/recipes/documentation) for the project
51+
52+
Install
53+
54+
```bash
55+
npm i -D @compodoc/compodoc
56+
```
57+
58+
npm script command:
59+
60+
```
61+
"doc": "compodoc -p tsconfig.json -s"
62+
```
63+
64+
Generate and serve documentation from port 8080
65+
66+
```bash
67+
npm run doc
68+
```
69+
70+
#### Curl
71+
72+
```bash
73+
curl --header "Content-Type: application/json" \
74+
--request POST \
75+
--data '{"orderNo": "3333", "customer": {"name": "benno","age":22}, "items": [{"name": "item1", "price": 27}, {"name": "item2", "price": 99}]}' \
76+
http://localhost:3000/
77+
78+
curl --header "Content-Type: application/json" \
79+
--request POST \
80+
--data '{"orderNo": "3333", "customer": {"name": "benno","age":22}, "items": [{"name": "item1", "price": 27, "frameSize": 55}, {"name": "item2", "price": 99, "frameSize": 45}]}' \
81+
http://localhost:3000/
82+
83+
curl --header "Content-Type: application/json" \
84+
--request POST \
85+
--data '{"orderNo": "3333", "customer": {"name": "benno","age":22}, "items": [{"name": "item1", "price": 27, "size": "medium"}, {"name": "item2", "price": 99, "size": "medium"}]}' \
86+
http://localhost:3001/
87+
```
File renamed without changes.

0 commit comments

Comments
 (0)