very-express 0.5.26 → 0.6.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +35 -37
- package/.gitattributes +2 -2
- package/.github/copilot-instructions.md +107 -84
- package/.github/workflows/npm-start.yml +23 -23
- package/LICENSE +21 -21
- package/README.md +75 -75
- package/dist/index.js +1039 -1149
- package/dist/templates/_controllers/_ControllerFactory.ts +7 -3
- package/dist/templates/_middlewares/Authentication.ts +1 -5
- package/dist/templates/_middlewares/tsoaAuthentication.ts +24 -0
- package/dist/templates/_projectSettings/env +25 -24
- package/dist/templates/_projectSettings/package.json +50 -54
- package/dist/templates/_services/MongooseRepositoryAdapter.ts +48 -0
- package/dist/templates/_services/TypeOrmRepositoryAdapter.ts +59 -0
- package/dist/templates/_services/VexDb.ts +14 -0
- package/dist/templates/_services/VexDbConnector.ts +108 -163
- package/dist/templates/_services/VexSystem.ts +25 -42
- package/dist/templates/_services/auth/JWTService.ts +26 -14
- package/dist/templates/_services/oauth/OAuthProfileMap.ts +6 -14
- package/dist/templates/_services/oauth/OAuthStrategyService.ts +69 -51
- package/dist/templates/_types/IVexRepository.ts +18 -0
- package/dist/templates/_types/VexRequest.ts +11 -0
- package/dist/templates/_types/VexResponse.ts +25 -0
- package/dist/templates/_types/VexResponseError.ts +4 -3
- package/dist/templates/_types/responseObject.ts +1 -1
- package/dist/templates/_utils/common.ts +50 -16
- package/dist/templates/_utils/hash.ts +6 -5
- package/dist/templates/_utils/index.ts +2 -1
- package/dist/templates/_utils/logger.ts +15 -14
- package/dist/templates/_utils/processTimer.ts +1 -0
- package/dist/templates/_utils/response.ts +4 -3
- package/dist/templates/_utils/validator.ts +1 -0
- package/dist/templates/jsonSchema/Session.json +34 -31
- package/dist/templates/jsonSchema/User.json +50 -85
- package/dist/templates/jsonSchema/UserAuthProfiles.json +48 -0
- package/dist/templates/root/Dockerfile +19 -19
- package/dist/templates/root/README.md +38 -38
- package/dist/templates/root/public/css/style.css +7 -7
- package/dist/templates/root/public/js/login.js +58 -58
- package/dist/templates/root/public/js/logincallback.js +18 -18
- package/dist/templates/root/public/js/mytokens.js +10 -10
- package/dist/templates/root/public/js/refreshtokens.js +22 -22
- package/dist/templates/root/scripts/build.js +38 -38
- package/dist/templates/root/tsconfig.json +29 -27
- package/docs/ForeignKey.md +43 -43
- package/docs/appGenerated/auth.md +22 -22
- package/docs/developmentNote.md +22 -22
- package/docs/releaseNote/v0-5-0.md +17 -17
- package/docs/roadMap/futurePlan.md +9 -9
- package/docs/roadMap/released.md +49 -49
- package/docs/roadMap/v0-6-0.md +15 -15
- package/docs/vexJsonSchema.md +55 -55
- package/package.json +59 -58
- package/scripts/build.js +13 -13
- package/scripts/bump-version.js +86 -86
- package/scripts/copyTsTemplates.js +30 -30
- package/scripts/merge.js +124 -124
- package/tsconfig.json +121 -121
- package/vex.config.json +37 -36
- package/dist/templates/_types/VexResponsePayloadError.ts +0 -20
package/.eslintrc.json
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended"
|
|
9
|
-
],
|
|
10
|
-
"parser": "@typescript-eslint/parser",
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": "latest",
|
|
13
|
-
"sourceType": "module"
|
|
14
|
-
},
|
|
15
|
-
"plugins": [
|
|
16
|
-
"@typescript-eslint"
|
|
17
|
-
],
|
|
18
|
-
"rules": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2021": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended"
|
|
9
|
+
],
|
|
10
|
+
"parser": "@typescript-eslint/parser",
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"ecmaVersion": "latest",
|
|
13
|
+
"sourceType": "module"
|
|
14
|
+
},
|
|
15
|
+
"plugins": [
|
|
16
|
+
"@typescript-eslint"
|
|
17
|
+
],
|
|
18
|
+
"rules": {
|
|
19
|
+
"no-extra-semi": "off",
|
|
20
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
21
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
22
|
+
"indent": [
|
|
23
|
+
"warn",
|
|
24
|
+
4
|
|
25
|
+
],
|
|
26
|
+
"linebreak-style": [
|
|
27
|
+
"warn",
|
|
28
|
+
"unix"
|
|
29
|
+
],
|
|
30
|
+
"quotes": [
|
|
31
|
+
"off",
|
|
32
|
+
"double"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
package/.gitattributes
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
# Auto detect text files and perform LF normalization
|
|
2
|
-
* text=auto
|
|
1
|
+
# Auto detect text files and perform LF normalization
|
|
2
|
+
* text=auto
|
|
@@ -1,84 +1,107 @@
|
|
|
1
|
-
# Project Guidelines — VeryExpress
|
|
2
|
-
|
|
3
|
-
VeryExpress is a **code generator** that reads JSON Schema files and produces a complete Express.js REST API (with Mongoose, RBAC, OAuth2, Swagger). The CLI entry is `src/cli.ts`; the orchestrator is `src/index.ts` → `generate()`.
|
|
4
|
-
|
|
5
|
-
## Architecture
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
jsonSchema/*.json → preprocess → generators → templates → output/
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
| Directory | Role |
|
|
12
|
-
|-----------|------|
|
|
13
|
-
| `src/generators/` | Async `compile()` functions that call templates and write files |
|
|
14
|
-
| `src/templates/` | Static base files copied verbatim (with `.gen.ts` suffix) to output |
|
|
15
|
-
| `src/preprocess/` | Schema validation & normalisation before generation |
|
|
16
|
-
| `src/types/types.ts` | Core interfaces: `compilerOptions`, `jsonSchema`, `jsonSchemaPropsItem` |
|
|
17
|
-
| `src/utils/` | File I/O, logging, JSON-schema helpers, template formatter |
|
|
18
|
-
| `output/` | Generated Express app — **do not hand-edit `*.gen.ts` files** |
|
|
19
|
-
|
|
20
|
-
## Build and Test
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm run dev # compile (esbuild → dist/index.js) + run CLI
|
|
24
|
-
npm run build # lint + compile (production)
|
|
25
|
-
npm run lint # eslint --fix
|
|
26
|
-
npm run v <type> # bump version (major | minor | patch)
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
- Build bundles everything into a single `dist/index.js` via esbuild (platform: node, target: es2016).
|
|
30
|
-
- `scripts/copyTsTemplates.js` copies static templates into `output/` after compilation.
|
|
31
|
-
- No test suite exists yet; validate changes by running `npm run dev` and inspecting `output/`.
|
|
32
|
-
|
|
33
|
-
## Conventions
|
|
34
|
-
|
|
35
|
-
### Generator pattern
|
|
36
|
-
|
|
37
|
-
Every generator exports an async `compile(options)` that:
|
|
38
|
-
1. Validates / extracts data from options
|
|
39
|
-
2. Calls a `*Template()` function returning a string
|
|
40
|
-
3. Writes the result with `utils.common.writeFile()`
|
|
41
|
-
|
|
42
|
-
### Template pattern
|
|
43
|
-
|
|
44
|
-
- Template functions live in `*.template.ts` beside their generator.
|
|
45
|
-
- Use `{{placeholder}}` syntax replaced via `.replace(/{{placeholder}}/g, value)`.
|
|
46
|
-
- `FUNC{{ <code> }}` embeds runnable JS in generated output (processed by `utils/template.ts → format()`).
|
|
47
|
-
|
|
48
|
-
### Naming
|
|
49
|
-
|
|
50
|
-
| Artifact | Convention | Example |
|
|
51
|
-
|----------|-----------|---------|
|
|
52
|
-
| Generated files | `{DocName}{Type}.gen.ts` | `UserController.gen.ts` |
|
|
53
|
-
| Controller class | PascalCase | `UserController` |
|
|
54
|
-
| REST endpoint | lowercase `documentName` | `/user`, `/userContact` |
|
|
55
|
-
| Template function | camelCase default export | `controllerTemplate()` |
|
|
56
|
-
| Role class | `Role{Name}` | `RoleAdmin` |
|
|
57
|
-
|
|
58
|
-
### JSON Schema extensions
|
|
59
|
-
|
|
60
|
-
Custom `x-*` properties drive generation — see [docs/vexJsonSchema.md](../docs/vexJsonSchema.md):
|
|
61
|
-
|
|
62
|
-
- `x-documentConfig` — REST methods, document name
|
|
63
|
-
- `x-foreignKey` / `x-foreignValue` — relationships ([docs/ForeignKey.md](../docs/ForeignKey.md))
|
|
64
|
-
- `x-vexData: "role"` — marks role field for RBAC
|
|
65
|
-
- `x-format: "ObjectId"` — MongoDB ObjectId handling
|
|
66
|
-
|
|
67
|
-
### Path aliases
|
|
68
|
-
|
|
69
|
-
`tsconfig.json` maps `~/*` → `src/*`. Use `~/generators/...` style imports.
|
|
70
|
-
|
|
71
|
-
## Key docs (link, don't duplicate)
|
|
72
|
-
|
|
73
|
-
- [docs/vexJsonSchema.md](../docs/vexJsonSchema.md) — full schema definition guide
|
|
74
|
-
- [docs/ForeignKey.md](../docs/ForeignKey.md) — foreign-key joins and `_join`/`_select` params
|
|
75
|
-
- [docs/appGenerated/auth.md](../docs/appGenerated/auth.md) — JWT rolling keys, OAuth2 setup
|
|
76
|
-
- [docs/developmentNote.md](../docs/developmentNote.md) — dev conventions, `FUNC{{ }}` syntax
|
|
77
|
-
- [docs/roadMap/](../docs/roadMap/) — released features and upcoming plans
|
|
78
|
-
|
|
79
|
-
## Pitfalls
|
|
80
|
-
|
|
81
|
-
- **`output/` is regenerated** — never edit `*.gen.ts` files by hand; changes will be overwritten on next `vex` run.
|
|
82
|
-
- **Schema ↔ filename mismatch** — `x-documentConfig.documentName` must match the JSON schema filename (e.g. `User.json` → `"documentName": "User"`).
|
|
83
|
-
- **`required` field format** — the preprocessor normalises `required: true` on individual properties into a root-level `required: string[]`, but source schemas should use the array form.
|
|
84
|
-
- **No test runner** — confirm changes by running `npm run dev` and inspecting `output/`.
|
|
1
|
+
# Project Guidelines — VeryExpress
|
|
2
|
+
|
|
3
|
+
VeryExpress is a **code generator** that reads JSON Schema files and produces a complete Express.js REST API (with Mongoose, RBAC, OAuth2, Swagger). The CLI entry is `src/cli.ts`; the orchestrator is `src/index.ts` → `generate()`.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
jsonSchema/*.json → preprocess → generators → templates → output/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Directory | Role |
|
|
12
|
+
|-----------|------|
|
|
13
|
+
| `src/generators/` | Async `compile()` functions that call templates and write files |
|
|
14
|
+
| `src/templates/` | Static base files copied verbatim (with `.gen.ts` suffix) to output |
|
|
15
|
+
| `src/preprocess/` | Schema validation & normalisation before generation |
|
|
16
|
+
| `src/types/types.ts` | Core interfaces: `compilerOptions`, `jsonSchema`, `jsonSchemaPropsItem` |
|
|
17
|
+
| `src/utils/` | File I/O, logging, JSON-schema helpers, template formatter |
|
|
18
|
+
| `output/` | Generated Express app — **do not hand-edit `*.gen.ts` files** |
|
|
19
|
+
|
|
20
|
+
## Build and Test
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run dev # compile (esbuild → dist/index.js) + run CLI
|
|
24
|
+
npm run build # lint + compile (production)
|
|
25
|
+
npm run lint # eslint --fix
|
|
26
|
+
npm run v <type> # bump version (major | minor | patch)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Build bundles everything into a single `dist/index.js` via esbuild (platform: node, target: es2016).
|
|
30
|
+
- `scripts/copyTsTemplates.js` copies static templates into `output/` after compilation.
|
|
31
|
+
- No test suite exists yet; validate changes by running `npm run dev` and inspecting `output/`.
|
|
32
|
+
|
|
33
|
+
## Conventions
|
|
34
|
+
|
|
35
|
+
### Generator pattern
|
|
36
|
+
|
|
37
|
+
Every generator exports an async `compile(options)` that:
|
|
38
|
+
1. Validates / extracts data from options
|
|
39
|
+
2. Calls a `*Template()` function returning a string
|
|
40
|
+
3. Writes the result with `utils.common.writeFile()`
|
|
41
|
+
|
|
42
|
+
### Template pattern
|
|
43
|
+
|
|
44
|
+
- Template functions live in `*.template.ts` beside their generator.
|
|
45
|
+
- Use `{{placeholder}}` syntax replaced via `.replace(/{{placeholder}}/g, value)`.
|
|
46
|
+
- `FUNC{{ <code> }}` embeds runnable JS in generated output (processed by `utils/template.ts → format()`).
|
|
47
|
+
|
|
48
|
+
### Naming
|
|
49
|
+
|
|
50
|
+
| Artifact | Convention | Example |
|
|
51
|
+
|----------|-----------|---------|
|
|
52
|
+
| Generated files | `{DocName}{Type}.gen.ts` | `UserController.gen.ts` |
|
|
53
|
+
| Controller class | PascalCase | `UserController` |
|
|
54
|
+
| REST endpoint | lowercase `documentName` | `/user`, `/userContact` |
|
|
55
|
+
| Template function | camelCase default export | `controllerTemplate()` |
|
|
56
|
+
| Role class | `Role{Name}` | `RoleAdmin` |
|
|
57
|
+
|
|
58
|
+
### JSON Schema extensions
|
|
59
|
+
|
|
60
|
+
Custom `x-*` properties drive generation — see [docs/vexJsonSchema.md](../docs/vexJsonSchema.md):
|
|
61
|
+
|
|
62
|
+
- `x-documentConfig` — REST methods, document name
|
|
63
|
+
- `x-foreignKey` / `x-foreignValue` — relationships ([docs/ForeignKey.md](../docs/ForeignKey.md))
|
|
64
|
+
- `x-vexData: "role"` — marks role field for RBAC
|
|
65
|
+
- `x-format: "ObjectId"` — MongoDB ObjectId handling
|
|
66
|
+
|
|
67
|
+
### Path aliases
|
|
68
|
+
|
|
69
|
+
`tsconfig.json` maps `~/*` → `src/*`. Use `~/generators/...` style imports.
|
|
70
|
+
|
|
71
|
+
## Key docs (link, don't duplicate)
|
|
72
|
+
|
|
73
|
+
- [docs/vexJsonSchema.md](../docs/vexJsonSchema.md) — full schema definition guide
|
|
74
|
+
- [docs/ForeignKey.md](../docs/ForeignKey.md) — foreign-key joins and `_join`/`_select` params
|
|
75
|
+
- [docs/appGenerated/auth.md](../docs/appGenerated/auth.md) — JWT rolling keys, OAuth2 setup
|
|
76
|
+
- [docs/developmentNote.md](../docs/developmentNote.md) — dev conventions, `FUNC{{ }}` syntax
|
|
77
|
+
- [docs/roadMap/](../docs/roadMap/) — released features and upcoming plans
|
|
78
|
+
|
|
79
|
+
## Pitfalls
|
|
80
|
+
|
|
81
|
+
- **`output/` is regenerated** — never edit `*.gen.ts` files by hand; changes will be overwritten on next `vex` run.
|
|
82
|
+
- **Schema ↔ filename mismatch** — `x-documentConfig.documentName` must match the JSON schema filename (e.g. `User.json` → `"documentName": "User"`).
|
|
83
|
+
- **`required` field format** — the preprocessor normalises `required: true` on individual properties into a root-level `required: string[]`, but source schemas should use the array form.
|
|
84
|
+
- **No test runner** — confirm changes by running `npm run dev` and inspecting `output/`.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Core Rule
|
|
88
|
+
|
|
89
|
+
Respond like smart caveman. Cut articles, filler, pleasantries. Keep all technical substance.
|
|
90
|
+
|
|
91
|
+
## Grammar
|
|
92
|
+
|
|
93
|
+
- Drop articles (a, an, the)
|
|
94
|
+
- Drop filler (just, really, basically, actually, simply)
|
|
95
|
+
- Drop pleasantries (sure, certainly, of course, happy to)
|
|
96
|
+
- Short synonyms (big not extensive, fix not "implement a solution for")
|
|
97
|
+
- No hedging (skip "it might be worth considering")
|
|
98
|
+
- Fragments fine. No need full sentence
|
|
99
|
+
- Technical terms stay exact. "Polymorphism" stays "polymorphism"
|
|
100
|
+
- Code blocks unchanged. Caveman speak around code, not in code
|
|
101
|
+
- Error messages quoted exact. Caveman only for explanation
|
|
102
|
+
|
|
103
|
+
## Code Style
|
|
104
|
+
- always consider readability and maintainability.
|
|
105
|
+
- actively split different workflow's code into functions instead of large monolithic blocks.
|
|
106
|
+
- define types, avoid use `any` or `unknown` as possible.
|
|
107
|
+
- name variables, functions, interface, classes descriptively.
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- main
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
build:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v4
|
|
18
|
-
- uses: actions/setup-node@v3
|
|
19
|
-
with:
|
|
20
|
-
node-version: 22
|
|
21
|
-
- run: npm ci
|
|
22
|
-
- run: npm run build
|
|
23
|
-
- run: node ./dist/index.js -i
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: 22
|
|
21
|
+
- run: npm ci
|
|
22
|
+
- run: npm run build
|
|
23
|
+
- run: node ./dist/index.js -i
|
|
24
24
|
- run: npm run start
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 justin26l
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 justin26l
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
# VeryExpress
|
|
2
|
-
this is a generator to make [Express](https://github.com/expressjs/express) app
|
|
3
|
-
with custom REST API defined in [Json Schema](https://github.com/json-schema-org) and [Open Api](https://github.com/OAI)
|
|
4
|
-
|
|
5
|
-
# Features
|
|
6
|
-
- generate simple express.js server.
|
|
7
|
-
- generate custom REST API.
|
|
8
|
-
- API Validator by [express-validator](https://express-validator.github.io/docs/)
|
|
9
|
-
- generate OpenApi
|
|
10
|
-
- [Swagger UI Express](https://github.com/scottie1984/swagger-ui-express)
|
|
11
|
-
- OAuth by [Passport.js](https://www.passportjs.org/)
|
|
12
|
-
- Database Driver
|
|
13
|
-
- MongoDB by [Mongoose](https://mongoosejs.com/)
|
|
14
|
-
|
|
15
|
-
## Why use ExpressJs
|
|
16
|
-
express.js is a simple & flexible framework to build a web app, it provide balanced performance,
|
|
17
|
-
as this is open-source project, i want lower the technical barrier to contribute ideas,
|
|
18
|
-
eventually lead to a usefull and powerful framework.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# Quick Start
|
|
22
|
-
1. install package globally.
|
|
23
|
-
```npm i -g very-express```
|
|
24
|
-
|
|
25
|
-
3. use cli to initialize configuration file **vex.config.json** under your project root directory.
|
|
26
|
-
`vex -init`
|
|
27
|
-
|
|
28
|
-
2. create a empty directory and name it as value of vex.config's "jsonSchemaDir", by default `jsonSchema`.
|
|
29
|
-
`mkdir jsonSchema`.
|
|
30
|
-
|
|
31
|
-
4. you can create your db collection/table now in directory `./jsonSchema` just created,
|
|
32
|
-
refer to [Define Json Schmea](./docs/vexJsonSchema.md),
|
|
33
|
-
every changes require to regenerate app.
|
|
34
|
-
|
|
35
|
-
6. generate the app with vex.config param.
|
|
36
|
-
`vex`
|
|
37
|
-
|
|
38
|
-
7. you should saw a express typescript app being generated (with src, package.json etc) .
|
|
39
|
-
```
|
|
40
|
-
├── jsonSchema/
|
|
41
|
-
│ └── ...
|
|
42
|
-
├── src/
|
|
43
|
-
│ └── ...
|
|
44
|
-
├── package.json
|
|
45
|
-
├── tsconfig.json
|
|
46
|
-
├── vex.config.json
|
|
47
|
-
└── .env
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
8. start the generated express app.
|
|
51
|
-
```
|
|
52
|
-
npm i
|
|
53
|
-
npm build
|
|
54
|
-
npm run start
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Project Versioning
|
|
58
|
-
This project use versioning based on (Semantic Versioning)[https://semver.org/]
|
|
59
|
-
|
|
60
|
-
Use this instead :
|
|
61
|
-
```cmd
|
|
62
|
-
npm run v <version-type>
|
|
63
|
-
```
|
|
64
|
-
Version Types :
|
|
65
|
-
- `major` version when you make incompatible API changes
|
|
66
|
-
- `minor` version when you add functionality in a backward compatible manner
|
|
67
|
-
- `patch` version when you make backward compatible bug fixes
|
|
68
|
-
- `dev` simply mark for development, you should not publish under this versions
|
|
69
|
-
|
|
70
|
-
# Resources
|
|
71
|
-
- [Documents](./docs/)
|
|
72
|
-
- [Road Map](./docs/roadMap/)
|
|
73
|
-
- [ReleaseNote](./docs/releaseNote)
|
|
74
|
-
|
|
75
|
-
- [Discord](https://discord.gg/PZGMzDp7)
|
|
1
|
+
# VeryExpress
|
|
2
|
+
this is a generator to make [Express](https://github.com/expressjs/express) app
|
|
3
|
+
with custom REST API defined in [Json Schema](https://github.com/json-schema-org) and [Open Api](https://github.com/OAI)
|
|
4
|
+
|
|
5
|
+
# Features
|
|
6
|
+
- generate simple express.js server.
|
|
7
|
+
- generate custom REST API.
|
|
8
|
+
- API Validator by [express-validator](https://express-validator.github.io/docs/)
|
|
9
|
+
- generate OpenApi
|
|
10
|
+
- [Swagger UI Express](https://github.com/scottie1984/swagger-ui-express)
|
|
11
|
+
- OAuth by [Passport.js](https://www.passportjs.org/)
|
|
12
|
+
- Database Driver
|
|
13
|
+
- MongoDB by [Mongoose](https://mongoosejs.com/)
|
|
14
|
+
|
|
15
|
+
## Why use ExpressJs
|
|
16
|
+
express.js is a simple & flexible framework to build a web app, it provide balanced performance,
|
|
17
|
+
as this is open-source project, i want lower the technical barrier to contribute ideas,
|
|
18
|
+
eventually lead to a usefull and powerful framework.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Quick Start
|
|
22
|
+
1. install package globally.
|
|
23
|
+
```npm i -g very-express```
|
|
24
|
+
|
|
25
|
+
3. use cli to initialize configuration file **vex.config.json** under your project root directory.
|
|
26
|
+
`vex -init`
|
|
27
|
+
|
|
28
|
+
2. create a empty directory and name it as value of vex.config's "jsonSchemaDir", by default `jsonSchema`.
|
|
29
|
+
`mkdir jsonSchema`.
|
|
30
|
+
|
|
31
|
+
4. you can create your db collection/table now in directory `./jsonSchema` just created,
|
|
32
|
+
refer to [Define Json Schmea](./docs/vexJsonSchema.md),
|
|
33
|
+
every changes require to regenerate app.
|
|
34
|
+
|
|
35
|
+
6. generate the app with vex.config param.
|
|
36
|
+
`vex`
|
|
37
|
+
|
|
38
|
+
7. you should saw a express typescript app being generated (with src, package.json etc) .
|
|
39
|
+
```
|
|
40
|
+
├── jsonSchema/
|
|
41
|
+
│ └── ...
|
|
42
|
+
├── src/
|
|
43
|
+
│ └── ...
|
|
44
|
+
├── package.json
|
|
45
|
+
├── tsconfig.json
|
|
46
|
+
├── vex.config.json
|
|
47
|
+
└── .env
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
8. start the generated express app.
|
|
51
|
+
```
|
|
52
|
+
npm i
|
|
53
|
+
npm build
|
|
54
|
+
npm run start
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Project Versioning
|
|
58
|
+
This project use versioning based on (Semantic Versioning)[https://semver.org/]
|
|
59
|
+
|
|
60
|
+
Use this instead :
|
|
61
|
+
```cmd
|
|
62
|
+
npm run v <version-type>
|
|
63
|
+
```
|
|
64
|
+
Version Types :
|
|
65
|
+
- `major` version when you make incompatible API changes
|
|
66
|
+
- `minor` version when you add functionality in a backward compatible manner
|
|
67
|
+
- `patch` version when you make backward compatible bug fixes
|
|
68
|
+
- `dev` simply mark for development, you should not publish under this versions
|
|
69
|
+
|
|
70
|
+
# Resources
|
|
71
|
+
- [Documents](./docs/)
|
|
72
|
+
- [Road Map](./docs/roadMap/)
|
|
73
|
+
- [ReleaseNote](./docs/releaseNote)
|
|
74
|
+
|
|
75
|
+
- [Discord](https://discord.gg/PZGMzDp7)
|