Just exploring node.js and came across express; On the npm repository site https://www.npmjs.com/package/express it clearly states installation is
$ npm install express
but if i scroll down the quick start mentions
$ npm install -g express-generator@4
Can someone explain in detail what is going on? I googled and understand in express v3 both were bundled together, but in express v4 the generator was pulled out.
So do i need to install both? does the generator install express automatically but not the other way around? I have JS fatigue already, and i only just started :-(
Supplementary Question: Then to confuse matters even further, i saw another question that asks should I start with 'npm init' and require express, or 'express myApp'. What is really going on now, where does init come into it?
Update 30/Jan/2017 I've accepted an answer below from someone else, but I've also added my own answer which is what i was seeking back then as a confused complete beginner. It may help others.
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.
Express Generator is a Node. js Framework like ExpressJS which is used to create express Applications easily and quickly. It acts as a tool for generating express applications.
My understanding is:
As part of the boiler plate files is a package.json file defining the dependencies for your project - ie npm packages that you will need for your project. The express package is listed there.
Knowing the npm install instruction (run with current working directory set to project folder containing the package.json) will "install" all dependencies listed in package.json into your project folder to make them available to your application, it would be sufficient to do:
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