As you might know, express
released 4.1.0 recently. Now you can not use the command line "express" directly via npm intall -g express
which is working just well in version 3.x. When I read the Readme
in the package, I saw express-generator
. After npm install -g express-generator
, I can use the command line. So,what's the difference? Only for global install?
For learning Express, it's best to stick with the generator. Once you get a handle on how everything interacts and you feel comfortable making changes to the general structure, you could move onto other things or simply put together your own framework if you find yourself using the same general setup for projects.
You can run the application generator with the npx command (available in Node. js 8.2. 0). Then load http://localhost:3000/ in your browser to access the app.
With express 4 the express boilerplate generator command line was extracted to it's own module 'express-generator' because the generator app did not really share code with express web framework and express and generator app can be released independently.
I guess this was a step into the right direction to decouple the web framework from the boilerplate/skeleton generator since this makes express even more lightweight and leverages tools like yeoman that focus on generating things.
The difference is that with Express 4, a lot of middleware and other things that were not necessary for "core" Express were exported into separate modules. The Express project generator happened to be one of those things.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With