ExpressJS - 脚手架

ExpressJS - 脚手架 首页 / ExpressJS入门教程 / ExpressJS - 脚手架

脚手架(Scaffolding)使无涯教程能够轻松地为Web应用程序创建应用,手动创建公共目录,添加中间件,创建单独的路由文件等。脚手架工具设置了所有这些工作,以便可以直接开始构建应用程序。

将使用的脚手架称为 Yeoman,它是为 Node.js 构建的脚手架工具,但还具有用于其他几个框架(如flask,rails,django等)的生成器,要安装Yeoman,请在终端中输入以下命令-

npm install -g yeoman

Yeoman使用生成器来构建应用程序,要查看 npm 上可用于Yeoman的生成器,可以单击此链接。在本教程中将使用'generator-Express-simple'。要安装此生成器,请在终端中输入以下命令-

npm install -g generator-express-simple

要使用此生成器,请输入以下命令-

链接:https://www.learnfk.comhttps://www.learnfk.com/expressjs/expressjs-scaffolding.html

来源:LearnFk无涯教程网

yo express-simple test-app
express-simple comes with bootstrap and jquery
[?] Select the express version you want: 4.x
[?] Do you want an mvc express app: Yes
[?] Select the css preprocessor you would like to use: sass
[?] Select view engine you would like to use: jade
[?] Select the build tool you want to use for this project: gulp
[?] Select the build tool you want to use for this project: gulp
[?] Select the language you want to use for the build tool: javascript
   create public/sass/styles.scss
   create public/js/main.js
   create views/layout.jade
   create views/index.jade
   create views/404.jade
   create app.js
   create config.js
   create routes/index.js
   create package.json
   create bower.json
identical .bowerrc
identical .editorconfig
identical .gitignore
identical .jshintrc
   create gulpfile.js

I'm all done. Running bower install & npm install for you to install the
required dependencies. If this fails, try running the command yourself.

然后它将为您创建一个新的应用程序,安装所有依赖项,并为您提供可以使用的目录结构。

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

技术领导力实战笔记 -〔TGO鲲鹏会〕

技术管理实战36讲 -〔刘建国〕

.NET Core开发实战 -〔肖伟宇〕

编译原理实战课 -〔宫文学〕

用户体验设计实战课 -〔相辉〕

实用密码学 -〔范学雷〕

说透数字化转型 -〔付晓岩〕

eBPF核心技术与实战 -〔倪朋飞〕

结构思考力 · 透过结构看问题解决 -〔李忠秋〕

好记忆不如烂笔头。留下您的足迹吧 :)