clwy-express-generator 5.0.9 → 5.0.10

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
 
@@ -106,6 +106,7 @@ function createApplication (name, dir, options, done) {
106
106
  express: '~5.1.0'
107
107
  },
108
108
  devDependencies: {
109
+ cors: '^2.8.5',
109
110
  nodemon: '^3.1.9',
110
111
  prettier: '^3.5.3'
111
112
  }
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.10",
6
6
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
7
7
  "contributors": [
8
8
  "Aaron Heckmann <aaron.heckmann+github@gmail.com>",
@@ -28,6 +28,9 @@ app.set('view engine', '<%- view.engine %>');
28
28
  app.use(<%- use %>);
29
29
  <% }); -%>
30
30
 
31
+ // CORS
32
+ app.use(cors());
33
+
31
34
  // routes
32
35
  app.use(routes);
33
36
 
@@ -32,6 +32,9 @@ app.set('view engine', '<%- view.engine %>')
32
32
  app.use(<%- use %>)
33
33
  <% }) -%>
34
34
 
35
+ // CORS
36
+ app.use(cors())
37
+
35
38
  // routes
36
39
  app.use(routes)
37
40