Express' application generator.
Forked from express-generator, this project is a fork with some new features.
- 🚀 Support for ES6 syntax: The project now supports using ES6 syntax, making the code more modern and concise.
- 💾 Support for creating Prisma ORM project: The project now supports integrating Prisma ORM, simplifying database operations.
- 🔀 Split routes: The route files are now split into separate files, making them easier to manage and maintain.
- 📁 Added middleware folder: A new middleware folder has been added to store various middleware, improving the modularity of the code.
- 🔧 Added environment variable configuration file: The project now includes a configuration file for environment variables, making it easier to manage different environments.
- 🔄 nodemon has been added: The project now uses nodemon by default, automatically restarting the server during development when file changes are detected.
The quickest way to get started with express is to utilize the executable express(1)
to generate an application as shown below:
Create the app:
$ npx clwy-express-generator --view=ejs --orm --es6 demo && cd demo
Install dependencies:
$ npm install
Start your Express.js app at http://localhost:3000/
:
$ npm start
This generator can also be further configured with the following command line flags.
--version output the version number
-v, --view <engine> add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash|api) (defaults to ejs)
--no-view use static html instead of view engine
-c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
--git add .gitignore
--es6 generate ES6 code and module-type project (requires Node 14.x or higher)
-o, --orm use the Prisma ORM
-f, --force force on non-empty directory
-h, --help output usage information
Forked from express-generator,此项目是从这个项目派生而来,并添加了一些新特性。
- 🚀 支持ES6语法:项目现在支持使用ES6语法,使代码更加现代化和简洁。
- 💾 支持创建 Prisma ORM 项目:项目现在支持集成 Prisma ORM,简化了数据库操作。
- 🔀 分割路由:路由文件现在被拆分到单独的文件中,使它们更易于管理和维护。
- 📁 新增中间件文件夹:添加了一个新的中间件文件夹来存放各种中间件,提高了代码的模块化。
- 🔧 添加环境变量配置文件:项目现在包含一个环境变量的配置文件,使管理不同环境变得更加容易。
- 🔄 增加了 nodemon: 项目现在默认使用 nodemon,在开发过程中,当文件发生变化时会自动重启服务。
使用express最快的方式是利用可执行文件express(1)
来生成一个应用,如下所示:
创建应用:
$ npx clwy-express-generator --view=ejs --orm --es6 demo && cd demo
安装依赖:
$ npm install
在 http://localhost:3000/
启动您的 Express.js 应用:
$ npm start
此生成器还可以通过以下命令行标志进行进一步配置。
--version 输出版本号
-v, --view <engine> 添加视图引擎 <engine> 支持 (dust|ejs|hbs|hjs|jade|pug|twig|vash|api)(默认为 ejs)
--no-view 使用静态html而不是视图引擎
-c, --css <engine> 添加样式表引擎 <engine> 支持 (less|stylus|compass|sass)(默认为纯 css)
--git 添加 .gitignore 文件
--es6 生成 ES6 代码和模块类型项目(需要Node 14.x或更高版本)
-o, --orm 使用 Prisma ORM
-f, --force 强制在非空目录上操作
-h, --help 输出使用信息