clwy-express-generator 5.0.9 → 5.0.11

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/README.md CHANGED
@@ -13,6 +13,7 @@
13
13
  - **📁 中间件模块化**:新增文件夹存放中间件。
14
14
  - **🔧 增加环境变量配置**:多环境管理更便捷。
15
15
  - **🔄 集成nodemon**:开发时自动重启服务。
16
+ - **🌐 集成CORS**:允许跨域请求。
16
17
  - **📄 新增 README.md**:包含项目简介和基本功能说明。
17
18
  - **📦 内置配置**:默认包含`.prettierrc`(代码格式化)和`.gitignore`(文件忽略)。
18
19
 
@@ -67,6 +68,7 @@ $ npm start
67
68
  - **📁 Modular Middleware**: Dedicated folder for middleware.
68
69
  - **🔧 Environment Variables**: Easier multi-environment configuration.
69
70
  - **🔄 Nodemon Integration**: Auto-restart during development.
71
+ - **🌐 CORS Integration**: Allows cross-origin requests.
70
72
  - **📄 Added basic README.md**: Describes the project as a simple Express app with static file serving and basic routing.
71
73
  - **📦 Built-in Configs**: Includes `.prettierrc` (code formatting) and `.gitignore` (file exclusion) by default.
72
74
 
@@ -25,10 +25,9 @@ const args = parseArgs(process.argv.slice(2), {
25
25
  f: 'force',
26
26
  h: 'help',
27
27
  H: 'hogan',
28
- v: 'view',
29
- o: 'orm'
28
+ v: 'view'
30
29
  },
31
- boolean: ['ejs', 'es6', 'force', 'git', 'hbs', 'help', 'hogan', 'pug', 'version', 'orm'],
30
+ boolean: ['ejs', 'es6', 'force', 'git', 'hbs', 'help', 'hogan', 'pug', 'version'],
32
31
  default: { css: true, view: true },
33
32
  string: ['css', 'view'],
34
33
  unknown: function (s) {
@@ -106,6 +105,7 @@ function createApplication (name, dir, options, done) {
106
105
  express: '~5.1.0'
107
106
  },
108
107
  devDependencies: {
108
+ cors: '^2.8.5',
109
109
  nodemon: '^3.1.9',
110
110
  prettier: '^3.5.3'
111
111
  }
@@ -140,8 +140,9 @@ function createApplication (name, dir, options, done) {
140
140
  app.locals.uses.push('cookieParser()')
141
141
  pkg.dependencies['cookie-parser'] = '~1.4.7'
142
142
 
143
- // Env consts
144
- env.locals.orm = options.orm
143
+ // CORS
144
+ app.locals.modules.cors = 'cors'
145
+ app.locals.uses.push('cors()')
145
146
 
146
147
  if (dir !== '.') {
147
148
  mkdir(dir, '.')
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "clwy-express-generator",
3
3
  "description": "Express' application generator",
4
4
  "homepage": "https://github.com/clwy-cn/clwy-express-generator",
5
- "version": "5.0.9",
5
+ "version": "5.0.11",
6
6
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
7
7
  "contributors": [
8
8
  "Aaron Heckmann <aaron.heckmann+github@gmail.com>",
@@ -16,7 +16,6 @@ import 'dotenv/config'
16
16
  import routes from './config/routes.js'
17
17
 
18
18
  const __dirname = path.dirname(fileURLToPath(import.meta.url))
19
-
20
19
  const app = express()
21
20
 
22
21
  <% if (view) { -%>