Problems that ubuntu express 2.5.8 cannot change and the process of creating a new project

   I have already mentioned how to install express in my blog. Now I will talk about how express creates a new project.

Before creating the project, let me talk about my experience. Before I installed node and express with nvm on ubuntu, I used:

  $ sudo apt-get install node

  $ sudo apt-get install npm

Use this to install it, and then install express, it will first show that the installation is not successful, and then it will prompt you to use the command given by it and then install it. The express version of this fashion is 2.5.8, how to change it? The most direct way is to delete the node, npm and express you downloaded before by entering the delete command through the terminal, and then install node through nvm, and then install express. At this time, express is the latest version. able to pass:

$ express version to see if your version is 4x.

How to use nvm to view my blog.

Let's talk about how to create a project through express:

Enter the following command on the command line:

$ express -e blog
$ cd blog && npm install

 At this point, your project named blog has been successfully built, and then run the following command:

$ DEBUG=blog:* npm start

 Then visit in the browser; localhost:3000.

Let's take a look at the project structure of the project:

app.js: startup file, or entry file
package.json: stores project information and module dependencies. When adding dependent modules in dependencies, run npm install, npm will check the package.json in the current directory and install it automatically All specified modules
node_modules: store the modules installed in package.json, when you add dependent modules in package.json and install them, store them in this folder
public: store files such as image, css, js, etc.
routes: store routing files
views: store view files or template files
bin: store executable files

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326488392&siteId=291194637