简体   繁体   English

Express Generator和KrakenJS有什么区别?

[英]What's the difference between Express Generator and KrakenJS?

I'm new to Node development and have started using express recently. 我是Node开发的新手,最近开始使用Express。 I begin my projects using express generator which lays out the file structures and organizes routes, views, etc for me. 我使用Express Generator来开始我的项目,Express Generator可以为我布置文件结构并组织路线,视图等。 I went to KrakenJS' website recently and saw that it does the same thing, saying it organizes routes and stuff into separate folders. 我最近去了KrakenJS的网站,发现它做同样的事情,说它将路线和内容组织到单独的文件夹中。 So I was wondering what the difference or advantage of using one or the other? 所以我想知道使用其中一种的区别或优势是什么? From my understanding, they do the same thing. 据我了解,他们做同样的事情。 Please inform me if I'm wrong. 如果我错了,请通知我。

Express Generator will scaffold an Express app instance. Express Generator将搭建Express应用实例。 KrakenJS is built on top of Express and they define certain conventions. KrakenJS建立在Express之上,它们定义了某些约定。 Part of of those conventions when generating a kraken app is the app structure. 生成海妖应用程序时,这些约定的一部分是应用程序结构。 I would recommend getting familiar with Express first and then jump on to using Kraken. 我建议您先熟悉Express,然后再开始使用Kraken。

To further expand on @theoutlander's answer, KrakenJS acts more like a configuration layer on top of express. 为了进一步扩展@theoutlander的答案,KrakenJS的行为更像express之上的配置层。

It bundles together several modules that have been created (and open sourced) by PayPal to enhance the functionality of a plain vanilla express server. 它捆绑了由PayPal创建(和开源)的几个模块,以增强普通香草快递服务器的功能。

Kraken was initially built to satisfy enterprise concerns, so it may be overkill for small projects, but it does offer some very nice convenience features out-of-the-box: Kraken最初是为满足企业需求而构建的,因此对于小型项目来说可能有些过头,但它确实提供了一些非常好的便捷功能:

A couple of examples: (Note: If you see a feature you're interested in, but don't want the whole bunch, it can be cherry picked and added to a plain express app; as they're all separate modules) 有两个示例:(注意:如果您看到了您感兴趣的功能,但又不想全部使用,则可以挑选该功能并将其添加到普通Express应用程序中;因为它们都是单独的模块)

  • Security : Provided by the lusca module. 安全性 :由lusca模块提供。 Gives you protection for XSS, CSRF, X-Frame headers, an many more OWASP best security practices. 为您提供XSS,CSRF,X-Frame标头以及更多OWASP最佳安全性实践的保护。

  • Environment-specific configuration : Provided by the confit module. 特定于环境的配置 :由confit模块提供。 One of the more useful features, in my opinion. 我认为,这是更有用的功能之一。 You can separate configuration "profiles" for your application. 您可以为应用程序分离配置“配置文件”。 (eg: One configuration specific to the machine you develop on, vs one that's completely different from your final deploy environment) (例如:一种针对您所开发的计算机的配置,而另一种与最终部署环境完全不同的配置)

  • Middleware management : Provided by the meddleware module. 中间件管理 :由meddleware模块提供。 Let's you control the order in which middleware loads, and it's configuration as an external configuration to the app. 让我们控制中间件的加载顺序,并将其配置为应用程序的外部配置。 Keeps your code clean, and it's very powerful when combined with confit 保持代码干净,与confit结合使用时功能非常强大

These are just a few of the ones I find most useful, but there's a ton more that Kraken provides to make your life easier as an express dev. 这些只是我发现最有用的功能中的少数几个,但是Kraken提供了更多功能,使您作为一名快速开发人员的生活更加轻松。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “new”和直接调用生成器函数之间有什么区别? - What's the difference between “new” and directly invoking a generator function? node的bodyParser和express的urlencoded中间件有什么区别? - What is the difference between node's bodyParser and express's urlencoded middleware? express和http之间的技术差异是什么,连接就是这个问题 - what's the technical difference between express and http, and connect for that matter 快递路线中`/:foo *`和`/:foo(。*)`有什么区别? - What's the difference between `/:foo*` and `/:foo(.*)` in express routes? `2 == {}`和`{} == 2`之间有什么区别? - What's difference between `2 == {}` and `{} == 2` '$(this)'和'this'有什么区别? - What's the difference between '$(this)' and 'this'? (|)和(||)之间有什么区别? - What's the difference between ( | ) and ( || )? 在 Express 中进行路由时,应用程序级和路由器级中间件之间有什么区别? - What's the difference between application- and router level- middleware when routing in Express? Express4。 app.locals,res.locals和req.app.locals之间有什么区别? - Express4. What's the difference between app.locals, res.locals and req.app.locals? Node.js和Express应用程序中res.render()和ejs.render()之间的区别是什么 - What's the difference between res.render() and ejs.render() in Node.js and Express app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM