Skip to content

Commit a55aa20

Browse files
authored
Add files via upload
1 parent f261d96 commit a55aa20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1694
-0
lines changed

.env

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
TEST_KEY = 1
2+
3+
# application setting
4+
PROJECT_PORT = 3000
5+
PROJECT_HOST = 'localhost'
6+
7+
# database setting
8+
DATABASE_TYPE = 'mysql'
9+
DATABASE_HOST = 'localhost'
10+
DATABASE_PORT = 3306
11+
DATABASE_USERNAME = 'orm'
12+
DATABASE_PWD = '123456'
13+
DATABASE_REPO = 'orm'
14+
DATABASE_PREFIX = 'orm_'
15+
16+
# CacheModule
17+
CACHE_TTL = 5000
18+
19+
# application versioning
20+
URI_VERSIONING_PREFIX = 'v'
21+
URI_VERSIONING_DEFAULT = '1'
22+
23+
# multer: files stroage path
24+
FILE_UPLOAD_STORAGE_PATH = '/test/my-uploads'
25+
26+
# axios HTTPModule timeout
27+
HTTP_TIMEOUT = 5000
28+
# axios HTTPModule
29+
HTTP_MAX_REDIRECTS = 5
30+
31+
# protect application from blute-force attacks
32+
THROTTLE_TTL = 6000
33+
THROTTLE_LIMIT = 6

.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TEST_KEY = 2

.eslintrc.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
root: true, // true:停止在父级目录中寻找配置文件,以避免导致意想不到的结果
3+
// plugin 插件主要是为 eslint 新增一些检查规则
4+
// eslint-config-prettier 的作用是关闭eslint中与prettier相互冲突的规则。
5+
// eslint-plugin-prettier 的作用是赋予eslint用prettier格式化代码的能力。 安装依赖并修改.eslintrc文件
6+
// 'eslint-plugin-tsdoc': tsdoc
7+
plugins: ['@typescript-eslint', 'eslint-plugin-prettier'],
8+
/* 指定如何解析语法。*/
9+
parser: '@typescript-eslint/parser',
10+
/* 优先级低于parse的语法解析配置 */
11+
parserOptions: {
12+
parser: '@typescript-eslint/parser',
13+
},
14+
// estends 的作用,就是继承社区整理好的配置规则
15+
extends: [
16+
'plugin:@typescript-eslint/recommended', // typescript-eslint推荐规则,
17+
'prettier',
18+
'plugin:prettier/recommended',
19+
],
20+
rules: {
21+
'eol-last': 'off', // 要求或禁止文件末尾存在空行
22+
'no-unused-vars': 'off', // 未使用变量
23+
'no-plusplus': 'off', // 禁用一元操作符 ++ 和 --
24+
'no-trailing-spaces': 'off', // 禁用行尾空格
25+
'no-underscore-dangle': 'off', // 禁止标识符中有悬空下划线
26+
'no-nested-ternary': 'off', // 禁用嵌套的三元表达式
27+
'no-await-in-loop': 'off', // 禁止在循环中出现 await
28+
eqeqeq: 'off', // 要求使用 === 和 !==
29+
'no-bitwise': 'off', // 禁用按位运算符
30+
'no-tabs': 'off', // 禁用 tab
31+
'no-var': 'off', // 禁止使用 var
32+
'@typescript-eslint/no-unused-vars': 'off', // 未使用变量
33+
'@typescript-eslint/no-explicit-any': 'off', // 使用any
34+
// '@typescript-eslint/triple-slash-reference': 'off', // 禁用三斜线表达式
35+
// 'tsdoc/syntax': 'warn', // tsdoc
36+
endOfLine: "CRLF", //不让prettier检测文件每行结束的格式
37+
},
38+
// 设置您的脚本在哪种环境中运行。每个环境都会带来一组特定的预定义全局变量。可以简单理解为批量设置全局变量,这些环境不是互斥的,因此您一次可以定义多个环境。
39+
env: {
40+
node: true, // Node.js 全局变量和 Node.js 作用域
41+
commonjs: true, // CommonJS 全局变量和 CommonJS 作用域 (启用此环境用于使用 Browserify/WebPack 的 browser-only 代码)
42+
'shared-node-browser': true, // Node.js 和 Browser 通用的全局变量
43+
es6: true, // 启用除 modules 以外的所有 ECMAScript 6 特性 (这会自动将 `ecmaVersion` 解析器选项设置为 6)
44+
es2017: true, // 添加所有 ECMAScript 2017 的全局变量并且自动设置 `ecmaVersion` 解析器选项设置为 8
45+
es2020: true, // 添加所有 ECMAScript 2020 的全局变量并且自动设置 `ecmaVersion` 解析器选项设置为 11
46+
es2021: true, // 添加所有 ECMAScript 2021 的全局变量并且自动设置 `ecmaVersion` 解析器选项设置为 12
47+
worker: true, // web workers 全局变量
48+
},
49+
};

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all"
4+
}

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<p align="center">
2+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
3+
</p>
4+
5+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6+
[circleci-url]: https://circleci.com/gh/nestjs/nest
7+
8+
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9+
<p align="center">
10+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13+
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14+
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
15+
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
16+
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
17+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
18+
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
19+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
20+
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
21+
</p>
22+
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
23+
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
24+
25+
## Description
26+
27+
Nest.js 学习示例,涵盖官方文档的 `概述` `基本原理` `技术` `安全` 四个大块的所有知识点实例,助你更加快速的学会Nest.js!
28+
29+
请您动动发财的小手给我点个 Star 吧!感谢!~
30+
31+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
32+
33+
## Installation
34+
35+
```bash
36+
$ pnpm install
37+
```
38+
39+
## Running the app
40+
41+
```bash
42+
# development
43+
$ pnpm run start
44+
45+
# watch mode
46+
$ pnpm run start:dev
47+
48+
# production mode
49+
$ pnpm run start:prod
50+
```
51+
52+
## Test
53+
54+
```bash
55+
# unit tests
56+
$ pnpm run test
57+
58+
# e2e tests
59+
$ pnpm run test:e2e
60+
61+
# test coverage
62+
$ pnpm run test:cov
63+
```
64+
65+
## Support
66+
67+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
68+
69+
## Stay in touch
70+
71+
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
72+
- Website - [https://nestjs.com](https://nestjs.com/)
73+
- Twitter - [@nestframework](https://twitter.com/nestframework)
74+
75+
## License
76+
77+
Nest is [MIT licensed](LICENSE).

nest-cli.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://json.schemastore.org/nest-cli",
3+
"collection": "@nestjs/schematics",
4+
"sourceRoot": "src",
5+
"compilerOptions": {
6+
"deleteOutDir": true
7+
}
8+
}

package.json

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"name": "nest2",
3+
"version": "0.0.1",
4+
"description": "",
5+
"author": "",
6+
"private": true,
7+
"license": "MIT",
8+
"scripts": {
9+
"build": "nest build",
10+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
11+
"start": "nest start",
12+
"start:dev": "nest start --watch",
13+
"start:debug": "nest start --debug --watch",
14+
"start:prod": "node dist/main",
15+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16+
"test": "jest",
17+
"test:watch": "jest --watch",
18+
"test:cov": "jest --coverage",
19+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20+
"test:e2e": "jest --config ./test/jest-e2e.json"
21+
},
22+
"dependencies": {
23+
"@nestjs/common": "^10.0.0",
24+
"@nestjs/core": "^10.0.0",
25+
"@nestjs/platform-express": "~10.3.0",
26+
"reflect-metadata": "^0.1.13",
27+
"rxjs": "^7.8.1",
28+
"class-validator": "~0.14.0",
29+
"class-transformer": "~0.5.1",
30+
"@nestjs/mapped-types": "~2.0.4",
31+
"@nestjs/config": "~3.1.1",
32+
"@nestjs/typeorm": "~10.0.1",
33+
"mysql2": "~3.6.5",
34+
"typeorm": "~0.3.17",
35+
"@nestjs/jwt": "~10.2.0",
36+
"cache-manager": "~5.3.2",
37+
"@nestjs/cache-manager": "~2.1.1",
38+
"cookie-parser": "~1.4.6",
39+
"compression": "~1.7.4",
40+
"multer": "~1.4.5-lts.1",
41+
"@nestjs/axios": "~3.0.1",
42+
"axios": "~1.6.3",
43+
"helmet": "~7.1.0",
44+
"@nestjs/throttler": "~5.1.1"
45+
},
46+
"devDependencies": {
47+
"@nestjs/cli": "^10.0.0",
48+
"@nestjs/schematics": "^10.0.0",
49+
"@nestjs/testing": "^10.0.0",
50+
"@types/express": "~4.17.21",
51+
"@types/jest": "^29.5.2",
52+
"@types/node": "^20.3.1",
53+
"@types/supertest": "^2.0.12",
54+
"@typescript-eslint/eslint-plugin": "^6.0.0",
55+
"@typescript-eslint/parser": "^6.0.0",
56+
"eslint": "^8.42.0",
57+
"eslint-config-prettier": "^9.0.0",
58+
"eslint-plugin-prettier": "^5.0.0",
59+
"jest": "^29.5.0",
60+
"prettier": "^3.0.0",
61+
"source-map-support": "^0.5.21",
62+
"supertest": "^6.3.3",
63+
"ts-jest": "^29.1.0",
64+
"ts-loader": "^9.4.3",
65+
"ts-node": "^10.9.1",
66+
"tsconfig-paths": "^4.2.0",
67+
"typescript": "^5.1.3",
68+
"@types/cookie-parser": "~1.4.6",
69+
"@types/multer": "~1.4.11"
70+
},
71+
"jest": {
72+
"moduleFileExtensions": [
73+
"js",
74+
"json",
75+
"ts"
76+
],
77+
"rootDir": "src",
78+
"testRegex": ".*\\.spec\\.ts$",
79+
"transform": {
80+
"^.+\\.(t|j)s$": "ts-jest"
81+
},
82+
"collectCoverageFrom": [
83+
"**/*.(t|j)s"
84+
],
85+
"coverageDirectory": "../coverage",
86+
"testEnvironment": "node"
87+
}
88+
}

0 commit comments

Comments
 (0)